mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
6712fa580b
Former-commit-id: a9e681d47d47f9f09a22d8479705f62672f509b7 [formerly b7d17db57156675b06897bc289fe616628a47abb] [formerly e06d3b13b547356fb928288b09aaaaf1a60b8950 [formerly b4708348c6
]]
Former-commit-id: 43b18221e14269bada106e867b666f67a692c992 [formerly bee15f87fc2ecf5e8b4a0d74f41bde7617aef12a]
Former-commit-id: 733aaa6f3d5e3fc80dbb65ccc028d9f6ff6f73b7
26 lines
480 B
Go
26 lines
480 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/users"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(hashCmd)
|
|
}
|
|
|
|
var hashCmd = &cobra.Command{
|
|
Use: "hash <password>",
|
|
Version: rootCmd.Version,
|
|
Short: "Hashes a password",
|
|
Long: `Hashes a password using bcrypt algorithm.`,
|
|
Args: cobra.ExactArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
pwd, err := users.HashPwd(args[0])
|
|
checkErr(err)
|
|
fmt.Println(pwd)
|
|
},
|
|
}
|