Add auth group to create email token endpoint
This commit is contained in:
parent
0ea7b28a6b
commit
d96d84201e
3 changed files with 14 additions and 2 deletions
|
@ -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}')
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue