feat: only hash if it's default pw
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> Former-commit-id: f25a675cd60a328715febb7e6e799b28e3dbadec [formerly 09fc814b175a9d6ce7669daaaf64071c9de8d951] [formerly d53b7af3501535f25e74aef463c4b9d821486aa4 [formerly 550269d2edcd0d178d387829e332defd1a68bf42]] Former-commit-id: c21b1ecc3bdf6b1f8c9de8e18ba8d9a2777f0b27 [formerly a31b1e0ae18bc0bf69e83f564dfd50fb6b2c38b6] Former-commit-id: fc3ee85d741cd83eda2961bcff91fb9d5ebc42d1
This commit is contained in:
		
							parent
							
								
									25792232e6
								
							
						
					
					
						commit
						1aec3744d7
					
				
							
								
								
									
										11
									
								
								cmd/root.go
								
								
								
								
							
							
						
						
									
										11
									
								
								cmd/root.go
								
								
								
								
							| 
						 | 
				
			
			@ -43,7 +43,7 @@ func init() {
 | 
			
		|||
	vaddP(f, "scope", "s", ".", "scope to prepend to a user's scope when it is relative")
 | 
			
		||||
	vaddP(f, "baseurl", "b", "", "base url")
 | 
			
		||||
	vadd(f, "username", "admin", "username for the first user when using quick config")
 | 
			
		||||
	vadd(f, "password", "admin", "password for the first user when using quick config")
 | 
			
		||||
	vadd(f, "password", "", "hashed password for the first user when using quick config (default \"admin\")")
 | 
			
		||||
 | 
			
		||||
	if err := v.BindPFlags(f); err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
| 
						 | 
				
			
			@ -197,13 +197,16 @@ func quickSetup(cmd *cobra.Command) {
 | 
			
		|||
 | 
			
		||||
	username := v.GetString("username")
 | 
			
		||||
	password := v.GetString("password")
 | 
			
		||||
 | 
			
		||||
	if password == "" {
 | 
			
		||||
		password, err = users.HashPwd("admin")
 | 
			
		||||
		checkErr(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if username == "" || password == "" {
 | 
			
		||||
		checkErr(errors.New("username and password cannot be empty during quick setup"))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	password, err = users.HashPwd(password)
 | 
			
		||||
	checkErr(err)
 | 
			
		||||
 | 
			
		||||
	user := &users.User{
 | 
			
		||||
		Username:     username,
 | 
			
		||||
		Password:     password,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue