- if user not authenticated, should redirect to verification page
- if user authenticated, should redirect to profile page
- should have 4 digit inputs
- should focus on first input when page loaded
- should focus on next input when user enter a digit
- should focus on previous input when user press backspace
- should auto submit when user enter 4 digits
- should show error message when user enter wrong code
- should show loading when user submit code
- should redirect to profile page when user submit correct code
- able to paste code from clipboard
- input should be numeric only
- each input should be 1 numeric only
- should show username, quote , user photo and logout button
- should remove token and redirect to verification page when user click logout button
- should not log out user when user refresh page
This document provides detailed specifications and usage guidelines for the /api/verify
and /api/auth
endpoints.
Parameter | Type | Description |
---|---|---|
code | string | The verification code. |
{
"code": "12345"
}
Returns whether the verification code is valid. If valid, a token is also provided.
{
"valid": true,
"token": "example_token"
}
{
"valid": false
}
Header Name | Value | Description |
---|---|---|
Authorization | string | The token received from /api/verify |
If authorized, the response will contain the username,quote and photo. Otherwise, an error message will be provided. If valid, a token is also provided.
When valid:
{
"username": "johnDoe",
"quote": "Hello, World!",
"photo": "https://example.com/image.jpg"
}
{
"message": "unauthorized"
}