File tree 2 files changed +12
-10
lines changed
2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -79,12 +79,11 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
79
79
}
80
80
81
81
u := & models.User {
82
- Name : form .UserName ,
83
- Email : form .Email ,
84
- Passwd : form .Password ,
85
- IsActive : true ,
86
- LoginType : models .LoginPlain ,
87
- MustChangePassword : form .MustChangePassword ,
82
+ Name : form .UserName ,
83
+ Email : form .Email ,
84
+ Passwd : form .Password ,
85
+ IsActive : true ,
86
+ LoginType : models .LoginPlain ,
88
87
}
89
88
90
89
if len (form .LoginType ) > 0 {
@@ -95,9 +94,12 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
95
94
u .LoginName = form .LoginName
96
95
}
97
96
}
98
- if ! password .IsComplexEnough (form .Password ) {
99
- ctx .RenderWithErr (ctx .Tr ("form.password_complexity" ), tplUserNew , & form )
100
- return
97
+ if u .LoginType == models .LoginPlain {
98
+ if ! password .IsComplexEnough (form .Password ) {
99
+ ctx .RenderWithErr (ctx .Tr ("form.password_complexity" ), tplUserNew , & form )
100
+ return
101
+ }
102
+ u .MustChangePassword = form .MustChangePassword
101
103
}
102
104
if err := models .CreateUser (u ); err != nil {
103
105
switch {
Original file line number Diff line number Diff line change 42
42
<input id="password" name="password" type="password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}>
43
43
</div>
44
44
45
- <div class="inline field">
45
+ <div class="inline field local{{if ne .login_type "0-0"}} hide{{end}} ">
46
46
<div class="ui checkbox">
47
47
<label><strong>{{.i18n.Tr "auth.allow_password_change" }}</strong></label>
48
48
<input name="must_change_password" type="checkbox" checked>
You can’t perform that action at this time.
0 commit comments