mirror of
https://github.com/wahyd4/loginsrv.git
synced 2026-08-09 04:46:29 +10:00
Merge pull request #86 from nicolaspernoud/master
Allow Bcrypt $2a$ prefix
This commit is contained in:
+1
-1
@@ -97,7 +97,7 @@ func (a *Auth) Authenticate(username, password string) (bool, error) {
|
||||
if hash, exist := a.userHash[username]; exist {
|
||||
h := []byte(hash)
|
||||
p := []byte(password)
|
||||
if strings.HasPrefix(hash, "$2y$") || strings.HasPrefix(hash, "$2b$") {
|
||||
if strings.HasPrefix(hash, "$2y$") || strings.HasPrefix(hash, "$2b$") || strings.HasPrefix(hash, "$2a$") {
|
||||
matchErr := bcrypt.CompareHashAndPassword(h, p)
|
||||
return (matchErr == nil), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user