Corrects validation logic for static password check
This commit is contained in:
		| @@ -99,12 +99,11 @@ func (p *password) UnmarshalJSON(b []byte) error { | ||||
| 		Username: data.Username, | ||||
| 		UserID:   data.UserID, | ||||
| 	}) | ||||
| 	if len(data.Hash) == 0 && len(data.HashFromEnv) > 0 { | ||||
| 		data.Hash = os.Getenv(data.HashFromEnv) | ||||
| 	} | ||||
| 	if len(data.Hash) == 0 { | ||||
| 		if len(data.HashFromEnv) > 0 { | ||||
| 			data.Hash = os.Getenv(data.HashFromEnv) | ||||
| 		} else { | ||||
| 			return fmt.Errorf("no password hash provided") | ||||
| 		} | ||||
| 		return fmt.Errorf("no password hash provided") | ||||
| 	} | ||||
|  | ||||
| 	// If this value is a valid bcrypt, use it. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user