Adds MustChangePassword to user create/edit API, defaults to true (#6193)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
b1ffe7e47b
commit
7548037a64
3 changed files with 18 additions and 10 deletions
4
Gopkg.lock
generated
4
Gopkg.lock
generated
|
@ -11,11 +11,11 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:784d7948aaae61b9fe50aa15c69a62fb277268a47ed006748a7e25fa61b841c9"
|
||||
digest = "1:59b2036a2d4b51fc91018adebd33ec4a893aa2b11af3a606445fe8df5640f514"
|
||||
name = "code.gitea.io/sdk"
|
||||
packages = ["gitea"]
|
||||
pruneopts = "NUT"
|
||||
revision = "4a15722a627a9cf62a203a066e724e82556b3845"
|
||||
revision = "9c4f6485997bcff568e30cfe45165018ac5772c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5d72bbcc9c8667b11c3dc3cbe681c5a6f71e5096744c0bf7726ab5c6425d5dc4"
|
||||
|
|
|
@ -60,9 +60,13 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
|
|||
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)
|
||||
if ctx.Written() {
|
||||
|
@ -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
|
||||
|
|
4
vendor/code.gitea.io/sdk/gitea/admin_user.go
generated
vendored
4
vendor/code.gitea.io/sdk/gitea/admin_user.go
generated
vendored
|
@ -23,7 +23,7 @@ type CreateUserOption struct {
|
|||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
// required: true
|
||||
Password string `json:"password" binding:"Required;MaxSize(255)"`
|
||||
MustChangePassword bool `json:"must_change_password"`
|
||||
MustChangePassword *bool `json:"must_change_password"`
|
||||
SendNotify bool `json:"send_notify"`
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ type EditUserOption struct {
|
|||
// swagger:strfmt email
|
||||
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
Password string `json:"password" binding:"MaxSize(255)"`
|
||||
MustChangePassword bool `json:"must_change_password"`
|
||||
MustChangePassword *bool `json:"must_change_password"`
|
||||
Website string `json:"website" binding:"MaxSize(50)"`
|
||||
Location string `json:"location" binding:"MaxSize(50)"`
|
||||
Active *bool `json:"active"`
|
||||
|
|
Loading…
Add table
Reference in a new issue