fix(login): correct rendering of idps (#7151)

This commit is contained in:
Silvan 2024-01-05 15:35:51 +01:00 committed by GitHub
parent a5d4b08a99
commit 1f30776fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}