Register Endpoint

Register a new user

Untitled

(1) Checks that the request has the required fields (email, password, and role)

(2) Ensures the user doesn't already have an account

(3) Encrypts the password and creates the user's data

(4) If the security question is enabled, checks that the security question index is valid and that there is an answer

(5) Checks the permission level of the user using the config file

(6) If gmail is enabled, it sends an email with a generated PIN to verify the user

(7) Signs the jwt token, and the sends the signed token to the user along with the user's id and permission level

Example Request

url: "<http://localhost:8000/register>"
headers: {
    "Content-Type":"application/json",
}
body: {
    "email":"[email protected]",
    "password":"me",
    "role":"guest",
    "questionIdx":0, // Don't include if security question is not enabled
    "answer":"Mambo No. 5" // Don't include if security question is not enabled
}

Login Endpoint

Login as an existing user

Untitled

(1) Checks that the request has the required fields (email, password)

(2) Find a user with the associated email and check that he/she isn't a google user