1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

Add auth group to create email token endpoint

This commit is contained in:
Khushboo Verma 2024-02-02 14:03:20 +05:30
parent 0ea7b28a6b
commit d96d84201e
3 changed files with 14 additions and 2 deletions

View file

@ -1212,9 +1212,9 @@ App::post('/v1/account/tokens/magic-url')
App::post('/v1/account/tokens/email') App::post('/v1/account/tokens/email')
->desc('Create email token (OTP)') ->desc('Create email token (OTP)')
->groups(['api', 'account']) ->groups(['api', 'account', 'auth'])
->label('scope', 'sessions.write') ->label('scope', 'sessions.write')
->label('auth.type', 'email') ->label('auth.type', 'email-otp')
->label('audits.event', 'session.create') ->label('audits.event', 'session.create')
->label('audits.resource', 'user/{response.userId}') ->label('audits.resource', 'user/{response.userId}')
->label('audits.userId', '{response.userId}') ->label('audits.userId', '{response.userId}')

View file

@ -379,6 +379,12 @@ App::init()
} }
break; break;
case 'email-otp':
if (($auths['emailOTP'] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email OTP authentication is disabled for this project');
}
break;
default: default:
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Unsupported authentication route'); throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Unsupported authentication route');
break; break;

View file

@ -72,6 +72,12 @@ App::init()
} }
break; break;
case 'email-otp':
if (($auths['emailOTP'] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email OTP authentication is disabled for this project');
}
break;
default: default:
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Unsupported authentication route'); throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Unsupported authentication route');
break; break;