D
Size: a a a
D
V
OS
СМ
СМ
G
Record<'TEST' | 'TEST_ID', string>;
V
public async validateResetPasswordToken(
params: ValidateResetPasswordTokenRequestDTO
): Promise<ValidateResetPasswordTokenSuccessDTO | ValidateResetPasswordTokenErrorDTO> {
return this.httpClient
.post<ValidateResetPasswordTokenSuccessDTO>(
`${ environment.apiEndpoint}/auth/validate-reset-password-token`,
{params}
)
.toPromise()
}
@Post('validate-reset-password-token')
async validateResetPasswordToken (
@Body() validateToken: ValidateToken, @Res() res
) {
try {
this.logger.debug(validateToken.token)
const token = validateToken.token
this.logger.debug('token '+ token)
const isValid = await this.authService.validateToken(token)
this.logger.debug('result '+isValid)
if(isValid) {
res.json({isValid: true})
res.redirect(`${this.frontendURL}/set-new-password?token=${token}`)
} else {
res.redirect(`${this.frontendURL}`)
}
} catch (e) {
this.logger.debug(e)
return res.status(e.getStatus()).json(e)
}
}
V
V
[undefined]:@ntegral/nestjs-sentry: Error: Bad Request Exception
D
А
public async validateResetPasswordToken(
params: ValidateResetPasswordTokenRequestDTO
): Promise<ValidateResetPasswordTokenSuccessDTO | ValidateResetPasswordTokenErrorDTO> {
return this.httpClient
.post<ValidateResetPasswordTokenSuccessDTO>(
`${ environment.apiEndpoint}/auth/validate-reset-password-token`,
{params}
)
.toPromise()
}
@Post('validate-reset-password-token')
async validateResetPasswordToken (
@Body() validateToken: ValidateToken, @Res() res
) {
try {
this.logger.debug(validateToken.token)
const token = validateToken.token
this.logger.debug('token '+ token)
const isValid = await this.authService.validateToken(token)
this.logger.debug('result '+isValid)
if(isValid) {
res.json({isValid: true})
res.redirect(`${this.frontendURL}/set-new-password?token=${token}`)
} else {
res.redirect(`${this.frontendURL}`)
}
} catch (e) {
this.logger.debug(e)
return res.status(e.getStatus()).json(e)
}
}
${ environment.apiEndpoint}/auth/validate-reset-password-token
,V
${ environment.apiEndpoint}/auth/validate-reset-password-token
,V
ss
L
L
AB