Value: "",
Usage: "New password to set for user",
},
+ &cli.BoolFlag{
+ Name: "must-change-password",
+ Usage: "User must change password",
+ },
},
}
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
}
- Options:
- `--username value`, `-u value`: Username. Required.
- `--password value`, `-p value`: New password. Required.
+ - `--must-change-password`: If provided, the user is required to choose a new password after the login. Optional.
- Examples:
- `gitea admin user change-password --username myname --password asecurepassword`
- `must-change-password`: