feature add (#270)
This commit is contained in:
parent
ae087f2b38
commit
cfa346fe6b
|
@ -107,6 +107,8 @@ ldap:
|
||||||
group-name-modify: false
|
group-name-modify: false
|
||||||
# 是否允许更改用户DN
|
# 是否允许更改用户DN
|
||||||
user-name-modify: false
|
user-name-modify: false
|
||||||
|
# 默认邮箱后缀
|
||||||
|
default-email-suffix: "eryajf.net"
|
||||||
# 📢 即便用不到如下三段配置信息,也不要删除,否则会有一些奇怪的错误出现
|
# 📢 即便用不到如下三段配置信息,也不要删除,否则会有一些奇怪的错误出现
|
||||||
dingtalk:
|
dingtalk:
|
||||||
# 配置获取详细文档参考: http://ldapdoc.eryajf.net/pages/94f43a/
|
# 配置获取详细文档参考: http://ldapdoc.eryajf.net/pages/94f43a/
|
||||||
|
|
|
@ -149,6 +149,7 @@ type LdapConfig struct {
|
||||||
UserInitPassword string `mapstructure:"user-init-password" json:"userInitPassword"`
|
UserInitPassword string `mapstructure:"user-init-password" json:"userInitPassword"`
|
||||||
GroupNameModify bool `mapstructure:"group-name-modify" json:"groupNameModify"`
|
GroupNameModify bool `mapstructure:"group-name-modify" json:"groupNameModify"`
|
||||||
UserNameModify bool `mapstructure:"user-name-modify" json:"userNameModify"`
|
UserNameModify bool `mapstructure:"user-name-modify" json:"userNameModify"`
|
||||||
|
DefaultEmailSuffix string `mapstructure:"default-email-suffix" json:"defaultEmailSuffix"`
|
||||||
}
|
}
|
||||||
type EmailConfig struct {
|
type EmailConfig struct {
|
||||||
Host string `mapstructure:"host" json:"host"`
|
Host string `mapstructure:"host" json:"host"`
|
||||||
|
|
|
@ -96,8 +96,13 @@ func CommonAddUser(user *model.User, groups []*model.Group) error {
|
||||||
user.Introduction = user.Nickname
|
user.Introduction = user.Nickname
|
||||||
}
|
}
|
||||||
if user.Mail == "" {
|
if user.Mail == "" {
|
||||||
|
// 兼容
|
||||||
|
if len(config.Conf.Ldap.DefaultEmailSuffix) > 0 {
|
||||||
|
user.Mail = user.Username + "@" + config.Conf.Ldap.DefaultEmailSuffix
|
||||||
|
} else {
|
||||||
user.Mail = user.Username + "@eryajf.net"
|
user.Mail = user.Username + "@eryajf.net"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if user.JobNumber == "" {
|
if user.JobNumber == "" {
|
||||||
user.JobNumber = "0000"
|
user.JobNumber = "0000"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue