mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-16 02:35:12 +00:00
feat(login): additionally use email/phone for authentication (#4563)
* feat: add ability to disable login by email and phone * feat: check login by email and phone * fix: set verified email / phone correctly on notify users * update projection version * fix merge * fix email/phone verified reduce tests * fix user tests * loginname check * cleanup * fix: update user projection version to handle fixed statement
This commit is contained in:
@@ -18,6 +18,8 @@ type LoginPolicyWriteModel struct {
|
||||
HidePasswordReset bool
|
||||
IgnoreUnknownUsernames bool
|
||||
AllowDomainDiscovery bool
|
||||
DisableLoginWithEmail bool
|
||||
DisableLoginWithPhone bool
|
||||
PasswordlessType domain.PasswordlessType
|
||||
DefaultRedirectURI string
|
||||
PasswordCheckLifetime time.Duration
|
||||
@@ -40,6 +42,8 @@ func (wm *LoginPolicyWriteModel) Reduce() error {
|
||||
wm.HidePasswordReset = e.HidePasswordReset
|
||||
wm.IgnoreUnknownUsernames = e.IgnoreUnknownUsernames
|
||||
wm.AllowDomainDiscovery = e.AllowDomainDiscovery
|
||||
wm.DisableLoginWithEmail = e.DisableLoginWithEmail
|
||||
wm.DisableLoginWithPhone = e.DisableLoginWithPhone
|
||||
wm.DefaultRedirectURI = e.DefaultRedirectURI
|
||||
wm.PasswordCheckLifetime = e.PasswordCheckLifetime
|
||||
wm.ExternalLoginCheckLifetime = e.ExternalLoginCheckLifetime
|
||||
@@ -90,9 +94,19 @@ func (wm *LoginPolicyWriteModel) Reduce() error {
|
||||
if e.MultiFactorCheckLifetime != nil {
|
||||
wm.MultiFactorCheckLifetime = *e.MultiFactorCheckLifetime
|
||||
}
|
||||
if e.DisableLoginWithEmail != nil {
|
||||
wm.DisableLoginWithEmail = *e.DisableLoginWithEmail
|
||||
}
|
||||
if e.DisableLoginWithPhone != nil {
|
||||
wm.DisableLoginWithPhone = *e.DisableLoginWithPhone
|
||||
}
|
||||
case *policy.LoginPolicyRemovedEvent:
|
||||
wm.State = domain.PolicyStateRemoved
|
||||
}
|
||||
}
|
||||
return wm.WriteModel.Reduce()
|
||||
}
|
||||
|
||||
func (wm *LoginPolicyWriteModel) Exists() bool {
|
||||
return wm.State.Exists()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user