mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
add --skip-bcrypt option to register command
This commit is contained in:
parent
94805b6e80
commit
5d24865936
@ -22,6 +22,10 @@ var registerCmd = cli.Command{
|
||||
Name: "password, p",
|
||||
Usage: "user password",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "skip-bcrypt",
|
||||
Usage: "store password string as is, skipping bcrypt",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -37,9 +41,14 @@ func register(c *cli.Context) error {
|
||||
}
|
||||
|
||||
user := models.NewUser(email, password)
|
||||
err := app.database.SaveUser(&user)
|
||||
|
||||
if err != nil {
|
||||
// set password manually if --skip-bcrypt was given
|
||||
// this is used to supply an already encrypted password string
|
||||
if c.Bool("skip-bcrypt") {
|
||||
user.Password = password
|
||||
}
|
||||
|
||||
if err := app.database.SaveUser(&user); err != nil {
|
||||
return fmt.Errorf("Error creating user: %s", err)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user