Skip to content

Commit

Permalink
Adds MustChangePassword to user create/edit API, defaults to true (go…
Browse files Browse the repository at this point in the history
…-gitea#6193)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
  • Loading branch information
jolheiser authored and lafriks committed Feb 27, 2019
1 parent b1ffe7e commit 7548037
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions vendor/code.gitea.io/sdk/gitea/admin_user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7548037

Please sign in to comment.