Skip to content
JainalGandhi edited this page Mar 20, 2020 · 7 revisions

1. /api/User/login

Method: POST

Description: This method is used to login (be allocated a JWT token) a user with the specified username and password

Body Input

Parameters Format
login LoginDTO Object

Request Body example

{
    "username": "YinWang"
    "password": "password"
}

Response

example request URL: https://localhost:5001/api/User/login

STATUS CODE: 404 NOT FOUND No username exists

STATUS CODE: 403 FORBIDDEN Incorrect password

STATUS CODE: 200 OK Successful login

The response of a successful login

{
    "userName": "string",
    "token": "<JWT token here>"
}

2. /api/User/resetTokenCheck

Method: POST

Description: Confirm if the given reset password token for a user is valid

Body Input

Parameters Format
resetPassword ResetPasswordDTO Object

Request Body example

{
    "email": "YinWang@gmail.com"
    "resetToken": "<reset token here>"
}

Response

example request URL: https://localhost:5001/api/User/resetTokenCheck

STATUS CODE: 400 Bad Request No reset token exists

STATUS CODE: 200 OK Reset token exists

3. /api/User/resetPassWord

Method: POST

Description: Update the given user's password

Body Input

Parameters Format
login LoginDto Object

Request Body example

{
    "email": "YinWang@gmail.com"
    "password": "newpassword123"
}

Response

example request URL: https://localhost:5001/api/User/resetPassWord

STATUS CODE: 404 NOT FOUND No username exists

STATUS CODE: 400 BAD REQUEST User does not have valid password change request

STATUS CODE: 200 OK Password successfully reset

4. /api/User/forgotPassword

Method: POST

Description: Send reset password link to user's E-mail

Body Input

Parameters Format
forgotPass ForgotPassRequestDTO Object

Request Body example

{
    "userOrEmail": "YinWang"
}

Response

example request URL: https://localhost:5001/api/User/resetPassWord

STATUS CODE: 404 NOT FOUND Invalid username/email sent

STATUS CODE: 200 OK

The response of a successful request password change

{
    "email": "string",
    "resetToken": "<Password reset token>"
}

Clone this wiki locally