From 1f30776fc2ea45dd795d77c81bf9fddb1b4100fe Mon Sep 17 00:00:00 2001 From: Silvan Date: Fri, 5 Jan 2024 15:35:51 +0100 Subject: [PATCH] fix(login): correct rendering of idps (#7151) --- internal/domain/policy_login.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/domain/policy_login.go b/internal/domain/policy_login.go index 6c4214724d..41364582c3 100644 --- a/internal/domain/policy_login.go +++ b/internal/domain/policy_login.go @@ -66,6 +66,13 @@ func (p IDPProvider) IsValid() bool { return p.IDPConfigID != "" } +// DisplayName returns the name or a default +// It's used for html rendering +// to be used when always a name must be displayed (e.g. login) +func (p IDPProvider) DisplayName() string { + return IDPName(p.Name, p.IDPType) +} + type PasswordlessType int32 const ( @@ -79,6 +86,12 @@ func (f PasswordlessType) Valid() bool { return f >= 0 && f < passwordlessCount } +// HasSecondFactors is used in html rendering func (p *LoginPolicy) HasSecondFactors() bool { return len(p.SecondFactors) > 0 } + +// HasMultiFactors is used in html rendering +func (p *LoginPolicy) HasMultiFactors() bool { + return len(p.MultiFactors) > 0 +}