diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/admin/user.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index e35beffc92..cf52d649ad 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -56,12 +56,16 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) { // "422": // "$ref": "#/responses/validationError" u := &models.User{ - Name: form.Username, - FullName: form.FullName, - Email: form.Email, - Passwd: form.Password, - IsActive: true, - LoginType: models.LoginPlain, + Name: form.Username, + FullName: form.FullName, + Email: form.Email, + Passwd: form.Password, + MustChangePassword: true, + IsActive: true, + LoginType: models.LoginPlain, + } + if form.MustChangePassword != nil { + u.MustChangePassword = *form.MustChangePassword } parseLoginSource(ctx, u, form.SourceID, form.LoginName) @@ -135,6 +139,10 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) { u.HashPassword(form.Password) } + if form.MustChangePassword != nil { + u.MustChangePassword = *form.MustChangePassword + } + u.LoginName = form.LoginName u.FullName = form.FullName u.Email = form.Email |