Disabled otp signin support

This commit is contained in:
Matej Bačo
2024-01-26 09:20:46 +01:00
parent fff5e91347
commit f581147601
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -1213,7 +1213,7 @@ App::post('/v1/account/tokens/email')
->desc('Create email token (OTP)')
->groups(['api', 'account'])
->label('scope', 'sessions.write')
->label('auth.type', 'email')
->label('auth.type', 'emailOtp')
->label('audits.event', 'session.create')
->label('audits.resource', 'user/{response.userId}')
->label('audits.userId', '{response.userId}')
+7 -1
View File
@@ -333,8 +333,14 @@ App::init()
$auths = $project->getAttribute('auths', []);
switch ($route->getLabel('auth.type', '')) {
case 'emailPassword':
if (($auths['emailOtp'] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email OTP authentication is disabled for this project');
}
break;
case 'emailOtp':
if (($auths['emailPassword'] ?? true) === false) {
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Email / Password authentication is disabled for this project');
throw new Exception(Exception::USER_AUTH_METHOD_UNSUPPORTED, 'Magic URL authentication is disabled for this project');
}
break;