|
|
|
@ -84,7 +84,6 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
|
|
|
|
|
Passwd: form.Password,
|
|
|
|
|
IsActive: true,
|
|
|
|
|
LoginType: models.LoginPlain,
|
|
|
|
|
MustChangePassword: form.MustChangePassword,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(form.LoginType) > 0 {
|
|
|
|
@ -95,10 +94,13 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
|
|
|
|
|
u.LoginName = form.LoginName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if u.LoginType == models.LoginPlain {
|
|
|
|
|
if !password.IsComplexEnough(form.Password) {
|
|
|
|
|
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplUserNew, &form)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
u.MustChangePassword = form.MustChangePassword
|
|
|
|
|
}
|
|
|
|
|
if err := models.CreateUser(u); err != nil {
|
|
|
|
|
switch {
|
|
|
|
|
case models.IsErrUserAlreadyExist(err):
|
|
|
|
|