diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/PlatformTwoFaSettings.java b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/PlatformTwoFaSettings.java
index 6f4b8d806f..fd72e7a027 100644
--- a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/PlatformTwoFaSettings.java
+++ b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/PlatformTwoFaSettings.java
@@ -41,7 +41,7 @@ public class PlatformTwoFaSettings {
private String verificationCodeCheckRateLimit;
@Min(value = 0, message = "maximum number of verification failure before user lockout must be positive")
private Integer maxVerificationFailuresBeforeUserLockout;
- @Min(value = 1, message = "total amount of time allotted for verification must be greater than 0")
+ @Min(value = 60, message = "total amount of time allotted for verification must be greater than or equal 60")
private Integer totalAllowedTimeForVerification;
diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html
index 9e0f54243f..1c6124bdc7 100644
--- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html
+++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html
@@ -51,7 +51,8 @@
admin.2fa.issuer-name
-
+
{{ "admin.2fa.issuer-name-required" | translate }}
@@ -118,7 +119,7 @@
admin.2fa.total-allowed-time-for-verification
-
+
{{ 'admin.2fa.total-allowed-time-for-verification-required' | translate }}
diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss
index 86254926b7..254cc51c22 100644
--- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss
+++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss
@@ -73,6 +73,10 @@
:host ::ng-deep {
.mat-expansion-panel {
+ .mat-expansion-panel-content {
+ font-size: 16px;
+ }
+
&.provider {
.mat-expansion-panel-header > .mat-content {
overflow: inherit;
diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts
index 895b80ed08..f4c7c2f1c9 100644
--- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts
@@ -122,7 +122,7 @@ export class TwoFactorAuthSettingsComponent extends PageComponent implements OnI
]],
totalAllowedTimeForVerification: [3600, [
Validators.required,
- Validators.min(1),
+ Validators.min(60),
Validators.pattern(/^\d*$/)
]],
verificationCodeCheckRateLimitEnable: [false],
@@ -192,7 +192,7 @@ export class TwoFactorAuthSettingsComponent extends PageComponent implements OnI
};
switch (provider) {
case TwoFactorAuthProviderType.TOTP:
- formControlConfig.issuerName = [{value: 'ThingsBoard', disabled: true}, Validators.required];
+ formControlConfig.issuerName = [{value: 'ThingsBoard', disabled: true}, [Validators.required, Validators.pattern(/^\S+$/)]];
break;
case TwoFactorAuthProviderType.SMS:
formControlConfig.smsVerificationMessageTemplate = [{value: 'Verification code: ${code}', disabled: true}, [
diff --git a/ui-ngx/src/app/modules/home/pages/security/security.component.ts b/ui-ngx/src/app/modules/home/pages/security/security.component.ts
index 34eda9781a..ab7d470e9e 100644
--- a/ui-ngx/src/app/modules/home/pages/security/security.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/security/security.component.ts
@@ -170,6 +170,9 @@ export class SecurityComponent extends PageComponent implements OnInit, OnDestro
confirm2FAChange(event: MouseEvent, provider: TwoFactorAuthProviderType) {
event.stopPropagation();
event.preventDefault();
+ if (this.twoFactorAuth.get(provider).disabled) {
+ return;
+ }
if (this.twoFactorAuth.get(provider).value) {
const providerName = this.translate.instant(`security.2fa.provider.${provider.toLowerCase()}`);
this.dialogService.confirm(
diff --git a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts
index 048fb83bbe..73401f2a0c 100644
--- a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts
+++ b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts
@@ -169,10 +169,11 @@ export class TwoFactorAuthLoginComponent extends PageComponent implements OnInit
$event.stopPropagation();
}
this.hideResendButton = true;
+ this.countDownTime = 0;
this.twoFactorAuthService.requestTwoFaVerificationCodeSend(this.selectedProvider).subscribe(() => {
this.countDownTime = this.minVerificationPeriod;
}, () => {
- this.countDownTime = 30;
+ this.countDownTime = this.minVerificationPeriod;
});
}
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index 25f27ed346..f54ec4c3a1 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -332,7 +332,7 @@
"retry-verification-code-period-pattern": "Minimal period time is 5 sec",
"retry-verification-code-period-required": "Retry verification code period is required.",
"total-allowed-time-for-verification": "Total allowed time for verification (sec)",
- "total-allowed-time-for-verification-pattern": "Total allowed time must be a positive integer.",
+ "total-allowed-time-for-verification-pattern": "Minimal total allowed time is 60 sec",
"total-allowed-time-for-verification-required": "Total allowed time is required.",
"use-system-two-factor-auth-settings": "Use system two factor auth settings",
"verification-code-check-rate-limit": "Verification code check rate limit",