Added comments
continuous-integration/drone/pr Build is passing Details

ref #40
This commit is contained in:
Nicolai Ort 2020-12-22 11:48:06 +01:00
parent 9458b774ea
commit 146787fd66
3 changed files with 7 additions and 3 deletions

View File

@ -87,6 +87,7 @@ export class AuthController {
@ResponseSchema(UsernameOrEmailNeededError)
@OpenAPI({ description: "Request a password reset token" })
async getResetToken(@Body({ validate: true }) passwordReset: CreateResetToken) {
//This really shouldn't just get returned, but sent via mail or sth like that. But for dev only this is fine.
return { "resetToken": await passwordReset.toResetToken() };
}

View File

@ -6,7 +6,8 @@ import { JwtCreator } from '../../jwtcreator';
import { User } from '../entities/User';
/**
* TODO:
* This calss is used to create password reset tokens for users.
* These password reset token can be used to set a new password for the user for the next 15mins.
*/
export class CreateResetToken {
/**
@ -41,8 +42,9 @@ export class CreateResetToken {
found_user.resetRequestedTimestamp = Math.floor(Date.now() / 1000);
await getConnectionManager().get().getRepository(User).save(found_user);
//Create the reset
//Create the reset token
let reset_token = JwtCreator.createReset(found_user);
return reset_token;
}
}

View File

@ -7,7 +7,8 @@ import { IllegalJWTError, JwtNotProvidedError, PasswordNeededError, RefreshToken
import { User } from '../entities/User';
/**
* TODO:
* This class can be used to reset a user's password.
* To set a new password the user needs to provide a valid password reset token.
*/
export class ResetPassword {
/**