mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix: send preferred login name on init user mail (#3105)
* fix: send preferred login name on init user * trigger gh actions Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
parent
a824312be3
commit
b64b5d89ec
@ -61,7 +61,7 @@ func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es
|
||||
func (configs Configs) cycleDuration(viewModel string) time.Duration {
|
||||
c, ok := configs[viewModel]
|
||||
if !ok {
|
||||
return 3 * time.Minute
|
||||
return 1 * time.Minute
|
||||
}
|
||||
return c.MinimumCycleDuration.Duration
|
||||
}
|
||||
|
@ -436,25 +436,5 @@ func (n *Notification) getTranslatorWithOrgTexts(orgID, textType string) (*i18n.
|
||||
}
|
||||
|
||||
func (n *Notification) getUserByID(userID string) (*model.NotifyUser, error) {
|
||||
user, usrErr := n.view.NotifyUserByID(userID)
|
||||
if usrErr != nil && !errors.IsNotFound(usrErr) {
|
||||
return nil, usrErr
|
||||
}
|
||||
if user == nil {
|
||||
user = &model.NotifyUser{}
|
||||
}
|
||||
events, err := n.getUserEvents(userID, user.Sequence)
|
||||
if err != nil {
|
||||
return user, usrErr
|
||||
}
|
||||
userCopy := *user
|
||||
for _, event := range events {
|
||||
if err := userCopy.AppendEvent(event); err != nil {
|
||||
return user, nil
|
||||
}
|
||||
}
|
||||
if userCopy.State == int32(model.UserStateDeleted) {
|
||||
return nil, errors.ThrowNotFound(nil, "HANDLER-3n8fs", "Errors.User.NotFound")
|
||||
}
|
||||
return &userCopy, nil
|
||||
return n.view.NotifyUserByID(userID)
|
||||
}
|
||||
|
@ -196,13 +196,11 @@ func (u *NotifyUser) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) e
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
policy := new(query2.OrgIAMPolicy)
|
||||
if policy == nil {
|
||||
policy, err = u.getDefaultOrgIAMPolicy(context.Background())
|
||||
|
||||
policy, err := u.getDefaultOrgIAMPolicy(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if !policy.UserLoginMustBeDomain {
|
||||
return nil
|
||||
}
|
||||
@ -225,13 +223,11 @@ func (u *NotifyUser) fillLoginNames(user *view_model.NotifyUser) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
policy := new(query2.OrgIAMPolicy)
|
||||
if policy == nil {
|
||||
policy, err = u.getDefaultOrgIAMPolicy(context.Background())
|
||||
|
||||
policy, err := u.getDefaultOrgIAMPolicy(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
user.SetLoginNames(policy, org.Domains)
|
||||
user.PreferredLoginName = user.GenerateLoginName(org.GetPrimaryDomain().Domain, policy.UserLoginMustBeDomain)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user