|
|
@ -56,12 +56,16 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) { |
|
|
|
// "422":
|
|
|
|
// "422":
|
|
|
|
// "$ref": "#/responses/validationError"
|
|
|
|
// "$ref": "#/responses/validationError"
|
|
|
|
u := &models.User{ |
|
|
|
u := &models.User{ |
|
|
|
Name: form.Username, |
|
|
|
Name: form.Username, |
|
|
|
FullName: form.FullName, |
|
|
|
FullName: form.FullName, |
|
|
|
Email: form.Email, |
|
|
|
Email: form.Email, |
|
|
|
Passwd: form.Password, |
|
|
|
Passwd: form.Password, |
|
|
|
IsActive: true, |
|
|
|
MustChangePassword: true, |
|
|
|
LoginType: models.LoginPlain, |
|
|
|
IsActive: true, |
|
|
|
|
|
|
|
LoginType: models.LoginPlain, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if form.MustChangePassword != nil { |
|
|
|
|
|
|
|
u.MustChangePassword = *form.MustChangePassword |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
parseLoginSource(ctx, u, form.SourceID, form.LoginName) |
|
|
|
parseLoginSource(ctx, u, form.SourceID, form.LoginName) |
|
|
@ -135,6 +139,10 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) { |
|
|
|
u.HashPassword(form.Password) |
|
|
|
u.HashPassword(form.Password) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.MustChangePassword != nil { |
|
|
|
|
|
|
|
u.MustChangePassword = *form.MustChangePassword |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
u.LoginName = form.LoginName |
|
|
|
u.LoginName = form.LoginName |
|
|
|
u.FullName = form.FullName |
|
|
|
u.FullName = form.FullName |
|
|
|
u.Email = form.Email |
|
|
|
u.Email = form.Email |
|
|
|