diff options
| author | Ryan Mehri <[email protected]> | 2020-05-11 21:07:23 -0600 |
|---|---|---|
| committer | Ryan Mehri <[email protected]> | 2020-05-11 21:07:23 -0600 |
| commit | 53f55ab8b0eceea32e58880c09785dd35943af0b (patch) | |
| tree | 8ecea62dff7644ec3cc4bde30d711f9204bf0b92 /backend/hashing | |
| parent | Rename good (diff) | |
| download | ctrl-v-53f55ab8b0eceea32e58880c09785dd35943af0b.tar.xz ctrl-v-53f55ab8b0eceea32e58880c09785dd35943af0b.zip | |
Simplify hashing comparison
Diffstat (limited to 'backend/hashing')
| -rw-r--r-- | backend/hashing/hash.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/backend/hashing/hash.go b/backend/hashing/hash.go index d4b2566..e944fbe 100644 --- a/backend/hashing/hash.go +++ b/backend/hashing/hash.go @@ -31,15 +31,11 @@ func HashPassword(password string) (string, error) { return string(hashedPassword), err } -func ComparePasswords(dbPassword, parsedPassword string) bool { +func PasswordsEqual(dbPassword, parsedPassword string) bool { dbPassBytes := []byte(dbPassword) parsedPassBytes := []byte(parsedPassword) compErr := bcrypt.CompareHashAndPassword(dbPassBytes, parsedPassBytes) // if comparison error, the given password is not valid - if compErr == nil { - return true - } else { - return false - } + return compErr == nil }
\ No newline at end of file |