@@ -62,6 +62,7 @@ import {
6262 captcha_swagger ,
6363 change_password_swagger ,
6464 check_identifier_swagger ,
65+ confirm_password_swagger ,
6566 facebook_callback_swagger ,
6667 facebook_oauth_swagger ,
6768 forget_password_swagger ,
@@ -89,6 +90,7 @@ import {
8990 verify_reset_otp_swagger ,
9091 verify_update_email_swagger ,
9192} from './auth.swagger' ;
93+ import { ConfirmPasswordDto } from './dto/confirm-password.dto' ;
9294
9395@ApiTags ( 'Authentication' )
9496@Controller ( 'auth' )
@@ -100,7 +102,7 @@ export class AuthController {
100102
101103 response . cookie ( 'refresh_token' , refresh , {
102104 httpOnly : true ,
103- secure : is_production ,
105+ secure : true ,
104106 sameSite : is_production ? 'strict' : 'none' ,
105107 maxAge : 7 * 24 * 60 * 60 * 1000 ,
106108 } ) ;
@@ -263,7 +265,6 @@ export class AuthController {
263265 return await this . auth_service . logoutAll ( refresh_token , response ) ;
264266 }
265267
266- @ApiCookieAuth ( 'refresh_token' )
267268 @ApiOperation ( refresh_token_swagger . operation )
268269 @ApiOkResponse ( refresh_token_swagger . responses . success )
269270 @ApiBadRequestErrorResponse ( ERROR_MESSAGES . NO_REFRESH_TOKEN_PROVIDED )
@@ -609,4 +610,21 @@ export class AuthController {
609610 this . httpOnlyRefreshToken ( response , refresh_token ) ;
610611 return { access_token, user } ;
611612 }
613+
614+ @ApiBearerAuth ( 'JWT-auth' )
615+ @UseGuards ( JwtAuthGuard )
616+ @ApiOperation ( confirm_password_swagger . operation )
617+ @ApiBody ( { type : ConfirmPasswordDto } )
618+ @ApiOkResponse ( confirm_password_swagger . responses . success )
619+ @ApiUnauthorizedErrorResponse ( ERROR_MESSAGES . WRONG_PASSWORD )
620+ @ApiUnauthorizedErrorResponse ( ERROR_MESSAGES . SOCIAL_LOGIN_REQUIRED )
621+ @ApiNotFoundErrorResponse ( ERROR_MESSAGES . USER_NOT_FOUND )
622+ @ResponseMessage ( SUCCESS_MESSAGES . PASSWORD_CONFIRMED )
623+ @Post ( 'confirm-password' )
624+ async confirmPassword (
625+ @Body ( ) confirm_password_dto : ConfirmPasswordDto ,
626+ @GetUserId ( ) user_id : string
627+ ) {
628+ return this . auth_service . confirmPassword ( confirm_password_dto , user_id ) ;
629+ }
612630}
0 commit comments