diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2024-02-03 18:53:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 18:53:27 +0100 |
commit | 9bea276055edc9527e3d6d66df3bbf0d20326f8b (patch) | |
tree | 0597bbc2a306ce542a8a1c19be62ec00889ea279 /cmd | |
parent | Include username in email headers (#28981) (diff) | |
download | forgejo-9bea276055edc9527e3d6d66df3bbf0d20326f8b.tar.xz forgejo-9bea276055edc9527e3d6d66df3bbf0d20326f8b.zip |
Add `must-change-password` cli parameter (#27626)
This PR adds a new `must-change-password` parameter to the
`change-password` cli command.
We already have the `must-change-password` command but it feels natural
to have this integrated into the `change-password` cli command.
---------
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/admin_user_change_password.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/admin_user_change_password.go b/cmd/admin_user_change_password.go index eebbfb3b67..22764318fd 100644 --- a/cmd/admin_user_change_password.go +++ b/cmd/admin_user_change_password.go @@ -32,6 +32,10 @@ var microcmdUserChangePassword = &cli.Command{ Value: "", Usage: "New password to set for user", }, + &cli.BoolFlag{ + Name: "must-change-password", + Usage: "User must change password", + }, }, } @@ -69,7 +73,11 @@ func runChangePassword(c *cli.Context) error { return err } - if err = user_model.UpdateUserCols(ctx, user, "passwd", "passwd_hash_algo", "salt"); err != nil { + if c.IsSet("must-change-password") { + user.MustChangePassword = c.Bool("must-change-password") + } + + if err = user_model.UpdateUserCols(ctx, user, "must_change_password", "passwd", "passwd_hash_algo", "salt"); err != nil { return err } |