File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,23 @@ export class PasswdController {
4848 public async resetbycode ( @Body ( ) body : ResetByCodeDto , @Res ( ) res : Response ) : Promise < Response > {
4949 const debug = { } ;
5050 this . logger . log ( 'Reset by code : ' + body . token + ' code : ' + body . code ) ;
51- const [ _ , data ] = await this . passwdService . resetByCode ( body ) ;
52- if ( process . env . NODE_ENV === 'development' ) {
53- debug [ '_debug' ] = data ;
51+ try {
52+ const [ _ , data ] = await this . passwdService . resetByCode ( body ) ;
53+ if ( process . env . NODE_ENV === 'development' ) {
54+ debug [ '_debug' ] = data ;
55+ }
56+
57+ return res . status ( HttpStatus . OK ) . json ( {
58+ message : 'Password changed' ,
59+ ...debug ,
60+ } ) ;
61+ } catch ( e ) {
62+ return res . status ( HttpStatus . BAD_REQUEST ) . json ( {
63+ message : 'Erreur serveur' ,
64+ ...debug ,
65+ } ) ;
5466 }
5567
56- return res . status ( HttpStatus . OK ) . json ( {
57- message : 'Password changed' ,
58- ...debug ,
59- } ) ;
6068 }
6169
6270 @Post ( 'reset' )
You can’t perform that action at this time.
0 commit comments