Bugfix for @lfk/frontend/#43
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
2021-02-07 13:37:01 +01:00
parent a18d4d3cee
commit 8f0a396dd0
4 changed files with 7 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ export class AuthController {
@OpenAPI({ description: 'Login with your username/email and password. <br> You will receive: \n * access token (use it as a bearer token) \n * refresh token (will also be sent as a cookie)' })
async login(@Body({ validate: true }) createAuth: CreateAuth, @Res() response: any) {
let auth;
console.log(createAuth)
try {
auth = await createAuth.toAuth();
response.cookie('lfk_backend__refresh_token', auth.refresh_token, { expires: new Date(auth.refresh_token_expires_at * 1000), httpOnly: true });
@@ -93,7 +94,7 @@ export class AuthController {
@ResponseSchema(UsernameOrEmailNeededError, { statusCode: 406 })
@OpenAPI({ description: "Request a password reset token. <br> This will provide you with a reset token that you can use by posting to /api/auth/reset/{token}." })
async getResetToken(@Body({ validate: true }) passwordReset: CreateResetToken) {
const reset_token: String = await passwordReset.toResetToken();
const reset_token: string = await passwordReset.toResetToken();
await this.mailer.sendResetMail(passwordReset.email, reset_token);
return new ResponseEmpty();
}