mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
Compare commits
3 Commits
v0.3.0-bet
...
v0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
143b13af2c | ||
|
|
4457d6f525 | ||
|
|
b901744e03 |
@@ -100,17 +100,19 @@ func HandleError(err error, msg string) {
|
||||
func init() {
|
||||
rootCmd.AddCommand(cmd.UserCmd())
|
||||
viper.AutomaticEnv()
|
||||
rootCmd.Flags().IntP("port", "p", 3000, "Port to run the server on.")
|
||||
rootCmd.Flags().Int("port", 3000, "Port to run the server on.")
|
||||
rootCmd.Flags().String("address", "0.0.0.0", "Address to bind the server to.")
|
||||
rootCmd.Flags().String("secret", "", "Secret to use for the cookie.")
|
||||
rootCmd.Flags().String("app-url", "", "The tinyauth URL.")
|
||||
rootCmd.Flags().String("users", "", "Comma separated list of users in the format username:bcrypt-hashed-password.")
|
||||
rootCmd.Flags().String("users-file", "", "Path to a file containing users in the format username:bcrypt-hashed-password.")
|
||||
rootCmd.Flags().Bool("cookie-secure", false, "Send cookie over secure connection only.")
|
||||
viper.BindEnv("port", "PORT")
|
||||
viper.BindEnv("address", "ADDRESS")
|
||||
viper.BindEnv("secret", "SECRET")
|
||||
viper.BindEnv("app-url", "APP_URL")
|
||||
viper.BindEnv("users", "USERS")
|
||||
viper.BindEnv("users-file", "USERS_FILE")
|
||||
viper.BindEnv("cookie-secure", "COOKIE_SECURE")
|
||||
viper.BindPFlags(rootCmd.Flags())
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ var CreateCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
CreateCmd.Flags().BoolVarP(&interactive, "interactive", "i", false, "Create a user interactively")
|
||||
CreateCmd.Flags().BoolVarP(&docker, "docker", "d", false, "Format output for docker")
|
||||
CreateCmd.Flags().StringVarP(&username, "username", "u", "", "Username")
|
||||
CreateCmd.Flags().StringVarP(&password, "password", "p", "", "Password")
|
||||
CreateCmd.Flags().BoolVar(&interactive, "interactive", false, "Create a user interactively")
|
||||
CreateCmd.Flags().BoolVar(&docker, "docker", false, "Format output for docker")
|
||||
CreateCmd.Flags().StringVar(&username, "username", "", "Username")
|
||||
CreateCmd.Flags().StringVar(&password, "password", "", "Password")
|
||||
}
|
||||
@@ -73,7 +73,7 @@ var VerifyCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
if docker {
|
||||
userSplit[1] = strings.ReplaceAll(password, "$$", "$")
|
||||
userSplit[1] = strings.ReplaceAll(userSplit[1], "$$", "$")
|
||||
}
|
||||
|
||||
verifyErr := bcrypt.CompareHashAndPassword([]byte(userSplit[1]), []byte(password))
|
||||
|
||||
Reference in New Issue
Block a user