mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 07:28:57 +00:00
* fix: disallow subzero login lifetimes values (#7065) * i18n invalid lifetimes --------- Co-authored-by: peintnermax <max@caos.ch>
This commit is contained in:
parent
cdc4a68443
commit
c7e45f7f49
@ -25,6 +25,15 @@ import { WarnDialogComponent } from '../../warn-dialog/warn-dialog.component';
|
||||
import { PolicyComponentServiceType } from '../policy-component-types.enum';
|
||||
import { LoginMethodComponentType } from './factor-table/factor-table.component';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
import { error } from 'console';
|
||||
|
||||
const minValueValidator = (minValue: number) => (control: AbstractControl) => {
|
||||
const value = control.value;
|
||||
if (value !== null && value < minValue) {
|
||||
return { minValue: true, message: `Minimum value allowed is ${minValue}.` };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-login-policy',
|
||||
@ -48,11 +57,11 @@ export class LoginPolicyComponent implements OnInit, OnDestroy {
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
public PasswordlessType: any = PasswordlessType;
|
||||
public lifetimeForm: UntypedFormGroup = this.fb.group({
|
||||
passwordCheckLifetime: [{ disabled: true }, [requiredValidator]],
|
||||
externalLoginCheckLifetime: [{ disabled: true }, [requiredValidator]],
|
||||
mfaInitSkipLifetime: [{ disabled: true }, [requiredValidator]],
|
||||
secondFactorCheckLifetime: [{ disabled: true }, [requiredValidator]],
|
||||
multiFactorCheckLifetime: [{ disabled: true }, [requiredValidator]],
|
||||
passwordCheckLifetime: [{ disabled: true }, [requiredValidator, minValueValidator(1)]],
|
||||
externalLoginCheckLifetime: [{ disabled: true }, [requiredValidator, minValueValidator(1)]],
|
||||
mfaInitSkipLifetime: [{ disabled: true }, [requiredValidator, minValueValidator(0)]],
|
||||
secondFactorCheckLifetime: [{ disabled: true }, [requiredValidator, minValueValidator(1)]],
|
||||
multiFactorCheckLifetime: [{ disabled: true }, [requiredValidator, minValueValidator(1)]],
|
||||
});
|
||||
private destroy$: Subject<void> = new Subject();
|
||||
|
||||
@ -285,6 +294,12 @@ export class LoginPolicyComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public savePolicy(): void {
|
||||
if (this.lifetimeForm.invalid) {
|
||||
// Display error message
|
||||
this.toast.showError('POLICY.LOGIN_POLICY.LIFETIME_INVALID', false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateData()
|
||||
.then(() => {
|
||||
this.toast.showInfo('POLICY.LOGIN_POLICY.SAVED', true);
|
||||
|
@ -1244,6 +1244,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Потребителите могат да избират от наличните доставчици на идентичност по-долу. ",
|
||||
"ADVANCED": "Разширено",
|
||||
"LIFETIMEDURATIONS": "Продължителност на влизане",
|
||||
"LIFETIME_INVALID": "Формулярът съдържа невалидни стойности.",
|
||||
"SAVED": "Запазено успешно!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1251,6 +1251,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Uživatelé si mohou vybrat z dostupných poskytovatelů identity níže. Poznámka: Můžete použít poskytovatele nastavené systémem, jakož i poskytovatele nastavené pouze pro vaši organizaci.",
|
||||
"ADVANCED": "Pokročilé",
|
||||
"LIFETIMEDURATIONS": "Doba trvání přihlášení",
|
||||
"LIFETIME_INVALID": "Formulář obsahuje neplatné hodnoty.",
|
||||
"SAVED": "Úspěšně uloženo!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1250,6 +1250,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Nutzer können sich mit den verfügbaren Idps authentifizieren. Achtung: Es kann zwischen System- und organisationsspezifischen Providern gewählt werden.",
|
||||
"ADVANCED": "Erweitert",
|
||||
"LIFETIMEDURATIONS": "Login Lifetimes",
|
||||
"LIFETIME_INVALID": "Login Lifetimes sind ungültig.",
|
||||
"SAVED": "Erfolgreich gespeichert."
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1251,6 +1251,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Users can choose from the available identity providers below. Note: You can use System-set providers as well as providers set for your organization only.",
|
||||
"ADVANCED": "Advanced",
|
||||
"LIFETIMEDURATIONS": "Login Lifetimes",
|
||||
"LIFETIME_INVALID": "Form contains invalid value(s).",
|
||||
"SAVED": "Saved successfully!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1252,6 +1252,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Los usuarios pueden elegir entre los siguientes proveedores de identidad. Nota: Puedes usar los proveedores integrados en el sistema así como sólo los proveedores configurados para tu organización.",
|
||||
"ADVANCED": "Avanzado",
|
||||
"LIFETIMEDURATIONS": "Tiempos de vida de los inicios de sesión",
|
||||
"LIFETIME_INVALID": "El formulario contiene valores no válidos.",
|
||||
"SAVED": "¡Guardado con éxito!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1250,6 +1250,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Les utilisateurs peuvent choisir parmi les fournisseurs d'identité disponibles ci-dessous. Note",
|
||||
"ADVANCED": "Avancé",
|
||||
"LIFETIMEDURATIONS": "Durée de vie des connexions",
|
||||
"LIFETIME_INVALID": "Le formulaire contient des valeurs non valides.",
|
||||
"SAVED": "Enregistré avec succès !"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1250,6 +1250,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Gli utenti possono scegliere tra gli IDP disponibili qui sotto. Nota: puoi usare i provider impostati nel sistema e quelli impostati della tua organizzazione.",
|
||||
"ADVANCED": "Impostazioni avanzate",
|
||||
"LIFETIMEDURATIONS": "Login Lifetimes",
|
||||
"LIFETIME_INVALID": "Login Lifetimes non sono validi",
|
||||
"SAVED": "Salvato con successo!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1247,6 +1247,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "ユーザーは、以下の利用可能なIDプロバイダーから選択できます。注:システムセットプロバイダーと、組織用に設定されたプロバイダーのみを使用できます。",
|
||||
"ADVANCED": "高度",
|
||||
"LIFETIMEDURATIONS": "ログインライフタイム",
|
||||
"LIFETIME_INVALID": "フォームに無効な値が含まれています。",
|
||||
"SAVED": "正常に保存されました!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1252,6 +1252,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Корисниците можат да избираат од достапните IDPs подолу. Забелешка: Можете да користите системски поставени IDPs, како и IDPs поставени само за вашата организација.",
|
||||
"ADVANCED": "Напредно",
|
||||
"LIFETIMEDURATIONS": "Време на траење на најавата",
|
||||
"LIFETIME_INVALID": "Формуларот содржи неважечки вредности.",
|
||||
"SAVED": "Успешно зачувано!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1251,6 +1251,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Gebruikers kunnen kiezen uit de beschikbare identiteitsproviders hieronder. Opmerking: U kunt systeem ingestelde providers gebruiken evenals providers die alleen voor uw organisatie zijn ingesteld.",
|
||||
"ADVANCED": "Geavanceerd",
|
||||
"LIFETIMEDURATIONS": "Login Levensduur",
|
||||
"LIFETIME_INVALID": "Formulier bevat ongeldige waarde(n).",
|
||||
"SAVED": "Succesvol opgeslagen!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1250,6 +1250,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Użytkownicy mogą wybrać z dostępnych poniżej dostawców tożsamości. Uwaga: Możesz korzystać z dostawców ustawionych przez system lub tylko dla twojej organizacji.",
|
||||
"ADVANCED": "Zaawansowane",
|
||||
"LIFETIMEDURATIONS": "Czasy trwania logowania",
|
||||
"LIFETIME_INVALID": "Formularz zawiera nieprawidłowe wartości.",
|
||||
"SAVED": "Pomyślnie zapisano!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1252,6 +1252,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Os usuários podem escolher entre os provedores de identidade disponíveis abaixo. Observação: você também pode usar provedores definidos pelo sistema e provedores definidos apenas para sua organização.",
|
||||
"ADVANCED": "Avançado",
|
||||
"LIFETIMEDURATIONS": "Duração do login",
|
||||
"LIFETIME_INVALID": "O formulário contém valores inválidos.",
|
||||
"SAVED": "Salvo com sucesso!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1237,6 +1237,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "Пользователи могут выбирать из доступных поставщиков удостоверений, указанных ниже. Примечание. Вы можете использовать поставщиков, установленных системой, а также поставщиков, установленных только для вашей организации.",
|
||||
"ADVANCED": "Продвинутые настройки",
|
||||
"LIFETIMEDURATIONS": "Время входа в систему",
|
||||
"LIFETIME_INVALID": "Formularul conține valori nevalide.",
|
||||
"SAVED": "Успешно сохранено!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
@ -1249,6 +1249,7 @@
|
||||
"DESCRIPTIONCREATEMGMT": "用户可以从以下可用的身份提供者中进行选择。注意:您可为系统设置提供者也可以仅为您的组织单独设置提供者。",
|
||||
"ADVANCED": "高级设置",
|
||||
"LIFETIMEDURATIONS": "登录状态有效期",
|
||||
"LIFETIME_INVALID": "表单包含无效值。",
|
||||
"SAVED": "保存成功!"
|
||||
},
|
||||
"PRIVACY_POLICY": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user