mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-11-28 11:22:10 +01:00
Move stuff to util.go
This commit is contained in:
parent
23ec7702fc
commit
b91ff5f0b5
6 changed files with 82 additions and 76 deletions
|
|
@ -306,19 +306,15 @@ func execUserChangeRole(c *cli.Context) error {
|
|||
}
|
||||
|
||||
func execUserHash(c *cli.Context) error {
|
||||
manager, err := createUserManager(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
password, err := readPasswordAndConfirm(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hash, err := manager.HashPassword(password)
|
||||
hash, err := user.HashPassword(password)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to hash password: %w", err)
|
||||
}
|
||||
fmt.Fprintf(c.App.Writer, "%s\n", string(hash))
|
||||
fmt.Fprintln(c.App.Writer, hash)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue