|
|
@ -79,12 +79,11 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
u := &models.User{ |
|
|
|
u := &models.User{ |
|
|
|
Name: form.UserName, |
|
|
|
Name: form.UserName, |
|
|
|
Email: form.Email, |
|
|
|
Email: form.Email, |
|
|
|
Passwd: form.Password, |
|
|
|
Passwd: form.Password, |
|
|
|
IsActive: true, |
|
|
|
IsActive: true, |
|
|
|
LoginType: models.LoginPlain, |
|
|
|
LoginType: models.LoginPlain, |
|
|
|
MustChangePassword: form.MustChangePassword, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if len(form.LoginType) > 0 { |
|
|
|
if len(form.LoginType) > 0 { |
|
|
@ -95,9 +94,12 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) { |
|
|
|
u.LoginName = form.LoginName |
|
|
|
u.LoginName = form.LoginName |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if !password.IsComplexEnough(form.Password) { |
|
|
|
if u.LoginType == models.LoginPlain { |
|
|
|
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplUserNew, &form) |
|
|
|
if !password.IsComplexEnough(form.Password) { |
|
|
|
return |
|
|
|
ctx.RenderWithErr(ctx.Tr("form.password_complexity"), tplUserNew, &form) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
u.MustChangePassword = form.MustChangePassword |
|
|
|
} |
|
|
|
} |
|
|
|
if err := models.CreateUser(u); err != nil { |
|
|
|
if err := models.CreateUser(u); err != nil { |
|
|
|
switch { |
|
|
|
switch { |
|
|
|