r002 / rittr

A Robertlandian take on Twitter...
0 stars 0 forks source link

Build the 'login' view-- this page lets the user either create a new account or login with an existing account via "otp login url by email" request. #14

Open r002 opened 4 years ago

r002 commented 4 years ago

Create User Spec:

URI: /v1/user Method: POST

Receive:

{
    title:  "Mayor",
    name:  "Dave the Mighty",
    sovereignty:  "Dave Nation",
    email:  "dave@example.com"
}

If User creation successful, return:

{
    status:  1,
    title:  "Mayor",
    name:  "Dave the Mighty",
    sovereignty:  "Dave Nation",
    email:  "dave@example.com"
}

If User creation failed, return:

{
    status:  0,
    errCode: "User.002" or "User.003"
    errMsg:  "User.002: Non-unique email address." or "User.003: Invalid field."
    title:  "Mayor",
    name:  "Dave the Mighty",
    sovereignty:  "Dave Nation",
    email:  "dave@example.com"
}

Notes/Questions: REST HTTP Headers? Always 200? Or 404 on invalid user? Need to still investigate. Always also return submitted user object back in payload?


Login User (Send OTP Email) Spec:

URI: /v1/otp_token Method: POST

Receive:

{
    email:  "user@example.com"
}

If User found, return:

{
    status:  1,
    email:  "user@example.com"
}

If User not found, return:

{
    status:  0,
    email:  "user@example.com"
}

Notes/Questions: REST HTTP Headers? Always 200? Or 404 on invalid user? Need to still investigate. Always also return submitted email back in payload?