Encrypt the password obtained from the flags
This commit is contained in:
parent
1d66bbe40a
commit
f866482f10
13
cmd/root.go
13
cmd/root.go
@ -48,7 +48,7 @@ func init() {
|
||||
persistent.StringP("database", "d", "./filebrowser.db", "database path")
|
||||
flags.Bool("noauth", false, "use the noauth auther when using quick setup")
|
||||
flags.String("username", "admin", "username for the first user when using quick config")
|
||||
flags.String("password", "", "hashed password for the first user when using quick config (default \"admin\")")
|
||||
flags.String("password", "admin", "hashed password for the first user when using quick config (default \"admin\")")
|
||||
|
||||
addServerFlags(flags)
|
||||
}
|
||||
@ -361,18 +361,9 @@ func quickSetup(flags *pflag.FlagSet, d pythonData) {
|
||||
username := getParam(flags, "username")
|
||||
password := getParam(flags, "password")
|
||||
|
||||
if password == "" {
|
||||
password, err = users.HashPwd("admin")
|
||||
checkErr(err)
|
||||
}
|
||||
|
||||
if username == "" || password == "" {
|
||||
log.Fatal("username and password cannot be empty during quick setup")
|
||||
}
|
||||
|
||||
user := &users.User{
|
||||
Username: username,
|
||||
Password: password,
|
||||
Password: users.HashPwd(password),
|
||||
LockPassword: false,
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user