mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 11:27:33 +00:00
feat: add hide password reset to login policy (#1806)
* feat: add hide password reset to login policy * feat: tests * feat: hide password reset in login * feat: hide password reset to frontend * feat: hide password reset to frontend * feat: hide password reset to frontend * feat: check feature * feat: feature in frontend
This commit is contained in:
@@ -29,6 +29,7 @@ type FeaturesSetEvent struct {
|
||||
LoginPolicyPasswordless *bool `json:"loginPolicyPasswordless,omitempty"`
|
||||
LoginPolicyRegistration *bool `json:"loginPolicyRegistration,omitempty"`
|
||||
LoginPolicyUsernameLogin *bool `json:"loginPolicyUsernameLogin,omitempty"`
|
||||
LoginPolicyPasswordReset *bool `json:"loginPolicyPasswordReset,omitempty"`
|
||||
PasswordComplexityPolicy *bool `json:"passwordComplexityPolicy,omitempty"`
|
||||
LabelPolicy *bool `json:"labelPolicy,omitempty"`
|
||||
CustomDomain *bool `json:"customDomain,omitempty"`
|
||||
@@ -120,6 +121,12 @@ func ChangeLoginPolicyUsernameLogin(loginPolicyUsernameLogin bool) func(event *F
|
||||
}
|
||||
}
|
||||
|
||||
func ChangeLoginPolicyPasswordReset(loginPolicyPasswordReset bool) func(event *FeaturesSetEvent) {
|
||||
return func(e *FeaturesSetEvent) {
|
||||
e.LoginPolicyPasswordReset = &loginPolicyPasswordReset
|
||||
}
|
||||
}
|
||||
|
||||
func ChangePasswordComplexityPolicy(passwordComplexityPolicy bool) func(event *FeaturesSetEvent) {
|
||||
return func(e *FeaturesSetEvent) {
|
||||
e.PasswordComplexityPolicy = &passwordComplexityPolicy
|
||||
|
@@ -24,7 +24,8 @@ func NewLoginPolicyAddedEvent(
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
forceMFA bool,
|
||||
forceMFA,
|
||||
hidePasswordReset bool,
|
||||
passwordlessType domain.PasswordlessType,
|
||||
) *LoginPolicyAddedEvent {
|
||||
return &LoginPolicyAddedEvent{
|
||||
@@ -37,6 +38,7 @@ func NewLoginPolicyAddedEvent(
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
forceMFA,
|
||||
hidePasswordReset,
|
||||
passwordlessType),
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,8 @@ func NewLoginPolicyAddedEvent(
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
forceMFA bool,
|
||||
forceMFA,
|
||||
hidePasswordReset bool,
|
||||
passwordlessType domain.PasswordlessType,
|
||||
) *LoginPolicyAddedEvent {
|
||||
return &LoginPolicyAddedEvent{
|
||||
@@ -38,6 +39,7 @@ func NewLoginPolicyAddedEvent(
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
forceMFA,
|
||||
hidePasswordReset,
|
||||
passwordlessType),
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package policy
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
@@ -22,6 +23,7 @@ type LoginPolicyAddedEvent struct {
|
||||
AllowRegister bool `json:"allowRegister,omitempty"`
|
||||
AllowExternalIDP bool `json:"allowExternalIdp,omitempty"`
|
||||
ForceMFA bool `json:"forceMFA,omitempty"`
|
||||
HidePasswordReset bool `json:"hidePasswordReset,omitempty"`
|
||||
PasswordlessType domain.PasswordlessType `json:"passwordlessType,omitempty"`
|
||||
}
|
||||
|
||||
@@ -38,7 +40,8 @@ func NewLoginPolicyAddedEvent(
|
||||
allowUserNamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
forceMFA bool,
|
||||
forceMFA,
|
||||
hidePasswordReset bool,
|
||||
passwordlessType domain.PasswordlessType,
|
||||
) *LoginPolicyAddedEvent {
|
||||
return &LoginPolicyAddedEvent{
|
||||
@@ -48,6 +51,7 @@ func NewLoginPolicyAddedEvent(
|
||||
AllowUserNamePassword: allowUserNamePassword,
|
||||
ForceMFA: forceMFA,
|
||||
PasswordlessType: passwordlessType,
|
||||
HidePasswordReset: hidePasswordReset,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +75,7 @@ type LoginPolicyChangedEvent struct {
|
||||
AllowRegister *bool `json:"allowRegister,omitempty"`
|
||||
AllowExternalIDP *bool `json:"allowExternalIdp,omitempty"`
|
||||
ForceMFA *bool `json:"forceMFA,omitempty"`
|
||||
HidePasswordReset *bool `json:"hidePasswordReset,omitempty"`
|
||||
PasswordlessType *domain.PasswordlessType `json:"passwordlessType,omitempty"`
|
||||
}
|
||||
|
||||
@@ -133,6 +138,12 @@ func ChangePasswordlessType(passwordlessType domain.PasswordlessType) func(*Logi
|
||||
}
|
||||
}
|
||||
|
||||
func ChangeHidePasswordReset(hidePasswordReset bool) func(*LoginPolicyChangedEvent) {
|
||||
return func(e *LoginPolicyChangedEvent) {
|
||||
e.HidePasswordReset = &hidePasswordReset
|
||||
}
|
||||
}
|
||||
|
||||
func LoginPolicyChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &LoginPolicyChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
|
Reference in New Issue
Block a user