mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 12:58:13 +00:00
feat: ( iam ) OTP-gate registration via IAM signup + set-password
This commit is contained in:
@@ -3,7 +3,7 @@ import { ApiTags, ApiOperation, ApiResponse, ApiBody, ApiBearerAuth } from '@nes
|
||||
import { Throttle, SkipThrottle } from '@nestjs/throttler';
|
||||
import { IsPublic } from '@tria-plc/api-common/modules/auth/decorators/public.decorator';
|
||||
import { PassengerAuthService } from './passenger-auth.service';
|
||||
import { RegisterDto, LoginDto, FaydaRequestPasswordSetupDto, FaydaVerifyAndLoginDto } from './auth.dto';
|
||||
import { RegisterDto, LoginDto, ResendRegistrationCodeDto, FaydaRequestPasswordSetupDto, FaydaVerifyAndLoginDto } from './auth.dto';
|
||||
import { JwtGuard } from '../../common/jwt.guard';
|
||||
|
||||
@ApiTags('Passenger Auth')
|
||||
@@ -14,14 +14,28 @@ export class AuthController {
|
||||
|
||||
@Post('register')
|
||||
@IsPublic()
|
||||
@ApiOperation({ summary: 'Register new passenger account' })
|
||||
@ApiResponse({ status: 201, description: 'Account created. Returns token + user.' })
|
||||
@ApiOperation({ summary: 'Register new passenger account (sends SMS verification code)' })
|
||||
@ApiResponse({
|
||||
status: 201,
|
||||
description:
|
||||
'Account created as pending. A verification code is sent via SMS — complete signup via PATCH /v1/auth/set-password.',
|
||||
})
|
||||
@ApiResponse({ status: 409, description: 'Email or phone already registered' })
|
||||
@ApiBody({ type: RegisterDto })
|
||||
register(@Request() req: any, @Body() dto: RegisterDto) {
|
||||
return this.passengerAuthService.register(dto, req);
|
||||
}
|
||||
|
||||
@Post('register/resend-code')
|
||||
@IsPublic()
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Resend the registration verification code for a pending account' })
|
||||
@ApiResponse({ status: 200, description: 'Verification code re-sent if the account is pending.' })
|
||||
@ApiBody({ type: ResendRegistrationCodeDto })
|
||||
resendRegistrationCode(@Request() req: any, @Body() dto: ResendRegistrationCodeDto) {
|
||||
return this.passengerAuthService.resendRegistrationCode(dto, req);
|
||||
}
|
||||
|
||||
@Post('login')
|
||||
@IsPublic()
|
||||
@HttpCode(HttpStatus.OK)
|
||||
|
||||
Reference in New Issue
Block a user