cli --must-change-password not working #8669

Closed
opened 2025-11-02 08:13:56 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @loynoir on GitHub (Mar 8, 2022).

Gitea Version

[Docker] Gitea version 1.16.3 built with GNU Make 4.3, go1.17.6 : bindata, timetzdata, sqlite, sqlite_unlock_notif

Git Version

No response

Operating System

No response

How are you running Gitea?

cli --must-change-password not working

$ docker run -p 3000:3000 -it gitea/gitea
$ docker exec -it $(docker ps|grep gitea|awk '{print $1}') bash

Visit Initial Configuration at http://localhost:3000/

# su git
$ gitea admin user create  --username foo  --password foo  --email foo@localhost  --must-change-password false

Still need to change password when first login

But using library generated by https://github.com/OpenAPITools/openapi-generator, --must-change-password false works fine.

Database

No response

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

No response

Screenshots

No response

Originally created by @loynoir on GitHub (Mar 8, 2022). ### Gitea Version [Docker] Gitea version 1.16.3 built with GNU Make 4.3, go1.17.6 : bindata, timetzdata, sqlite, sqlite_unlock_notif ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? cli `--must-change-password` not working ```sh $ docker run -p 3000:3000 -it gitea/gitea $ docker exec -it $(docker ps|grep gitea|awk '{print $1}') bash ``` Visit Initial Configuration at http://localhost:3000/ ```sh # su git $ gitea admin user create --username foo --password foo --email foo@localhost --must-change-password false ``` Still need to change password when first login But using library generated by `https://github.com/OpenAPITools/openapi-generator`, `--must-change-password false` works fine. ### Database _No response_ ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description _No response_ ### Screenshots _No response_
GiteaMirror added the type/question label 2025-11-02 08:13:56 -06:00
Author
Owner

@zeripath commented on GitHub (Mar 9, 2022):

gitea admin user create --username foo --password foo --email foo@localhost --must-change-password=false

@zeripath commented on GitHub (Mar 9, 2022): `gitea admin user create --username foo --password foo --email foo@localhost --must-change-password=false`
Author
Owner

@zeripath commented on GitHub (Mar 9, 2022):

Note the =

@zeripath commented on GitHub (Mar 9, 2022): Note the `=`
Author
Owner

@noerw commented on GitHub (Mar 9, 2022):

Looks like only bool flags require a = separator, afaik this is fixed in urfave/cli/v2.
But that version has quite stupid issues with flag / argument order when using global flags, that might be a blocker for switching to v2.

@noerw commented on GitHub (Mar 9, 2022): Looks like only bool flags require a `=` separator, afaik this is fixed in `urfave/cli/v2`. But that version has [quite stupid issues with flag / argument order when using global flags](https://github.com/urfave/cli/issues/1113), that might be a blocker for switching to v2.
Author
Owner

@loynoir commented on GitHub (Mar 9, 2022):

gitea admin user create --username foo --password foo --email foo@localhost --must-change-password=false

Yes, confirmed working with = way

@loynoir commented on GitHub (Mar 9, 2022): > `gitea admin user create --username foo --password foo --email foo@localhost --must-change-password=false` Yes, confirmed working with `=` way
Author
Owner

@zeripath commented on GitHub (Mar 9, 2022):

I think the BoolTFlag may have a slightly nicer behaviour.

@zeripath commented on GitHub (Mar 9, 2022): I think the BoolTFlag may have a slightly nicer behaviour.
Author
Owner

@techknowlogick commented on GitHub (Mar 11, 2022):

@noerw you'll find v1 has same global ordering pattern, which we've worked around.

Gonna close this now though.

@techknowlogick commented on GitHub (Mar 11, 2022): @noerw you'll find v1 has same global ordering pattern, which we've worked around. Gonna close this now though.
Author
Owner

@decentral1se commented on GitHub (Mar 18, 2022):

@noerw you'll find v1 has same global ordering pattern, which we've worked around.

@techknowlogick oh! would you mind sharing that work-around? i'm struggling with cli ordering with urfave also...

@decentral1se commented on GitHub (Mar 18, 2022): > @noerw you'll find v1 has same global ordering pattern, which we've worked around. @techknowlogick oh! would you mind sharing that work-around? i'm struggling with cli ordering with urfave also...
Author
Owner

@zeripath commented on GitHub (Mar 18, 2022):

fda5b9fc3e/main.go (L109-L127)

Look at the setFlagsAndBeforeOnSubcommands

@zeripath commented on GitHub (Mar 18, 2022): https://github.com/go-gitea/gitea/blob/fda5b9fc3e6dd831987979f37fe39f08963b875d/main.go#L109-L127 Look at the `setFlagsAndBeforeOnSubcommands`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8669