Skip to content

Commit e6827d4

Browse files
committed
add support for an admin to force a user to change his/her password from thee cli
1 parent 552d8d3 commit e6827d4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

cmd/admin.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ var (
5959
Value: "custom/conf/app.ini",
6060
Usage: "Custom configuration file path",
6161
},
62+
cli.StringFlag{
63+
Name: "must-change-password",
64+
Value: "false",
65+
Usage: "Force the user to change his/her password after initial login",
66+
},
6267
},
6368
}
6469

@@ -286,11 +291,12 @@ func runCreateUser(c *cli.Context) error {
286291
}
287292

288293
if err := models.CreateUser(&models.User{
289-
Name: c.String("name"),
290-
Email: c.String("email"),
291-
Passwd: c.String("password"),
292-
IsActive: true,
293-
IsAdmin: c.Bool("admin"),
294+
Name: c.String("name"),
295+
Email: c.String("email"),
296+
Passwd: c.String("password"),
297+
IsActive: true,
298+
IsAdmin: c.Bool("admin"),
299+
MustChangePassword: c.Bool("must-change-password"),
294300
}); err != nil {
295301
return fmt.Errorf("CreateUser: %v", err)
296302
}

0 commit comments

Comments
 (0)