Skip to content

Commit 5d5b218

Browse files
committed
fix: remove otp settings for service account app types
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent dc3532e commit 5d5b218

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/Models/OAuth2/Client.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
#[ORM\Cache('NONSTRICT_READ_WRITE')] // Class Client
4444
class Client extends BaseEntity implements IClient
4545
{
46+
private static array $allowed_otp_client_types = [
47+
IClient::ApplicationType_JS_Client,
48+
IClient::ApplicationType_Native,
49+
IClient::ApplicationType_Web_App
50+
];
51+
4652
/**
4753
* @var string
4854
*/
@@ -1667,9 +1673,11 @@ public function isPasswordlessEnabled(): bool
16671673

16681674
public function enablePasswordless(): void
16691675
{
1670-
$this->otp_enabled = true;
1671-
$this->otp_length = intval(Config::get("otp.length"));
1672-
$this->otp_lifetime = intval(Config::get("otp.lifetime"));
1676+
if (in_array($this->getApplicationType(), self::$allowed_otp_client_types)) {
1677+
$this->otp_enabled = true;
1678+
$this->otp_length = intval(Config::get("otp.length"));
1679+
$this->otp_lifetime = intval(Config::get("otp.lifetime"));
1680+
}
16731681
}
16741682

16751683
public function disablePasswordless(): void

0 commit comments

Comments
 (0)