diff --git a/src/controllers/AuthController.ts b/src/controllers/AuthController.ts index d6d8d81..022bffd 100644 --- a/src/controllers/AuthController.ts +++ b/src/controllers/AuthController.ts @@ -3,6 +3,7 @@ import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi'; import { IllegalJWTError, InvalidCredentialsError, JwtNotProvidedError, PasswordNeededError, RefreshTokenCountInvalidError, UsernameOrEmailNeededError } from '../errors/AuthError'; import { UserNotFoundError } from '../errors/UserErrors'; import { CreateAuth } from '../models/actions/CreateAuth'; +import { CreateResetToken } from '../models/actions/CreateResetToken'; import { HandleLogout } from '../models/actions/HandleLogout'; import { RefreshAuth } from '../models/actions/RefreshAuth'; import { Auth } from '../models/responses/ResponseAuth'; @@ -78,4 +79,13 @@ export class AuthController { } return response.send(auth) } + + @Post("/reset") + @ResponseSchema(Auth) + @ResponseSchema(UserNotFoundError) + @ResponseSchema(UsernameOrEmailNeededError) + @OpenAPI({ description: "Request a password reset token" }) + async getResetToken(@Body({ validate: true }) passwordReset: CreateResetToken) { + return await passwordReset.toResetToken(); + } }