aboutsummaryrefslogtreecommitdiff
path: root/backend/hashing
diff options
context:
space:
mode:
authorRyan Mehri <[email protected]>2020-05-11 20:55:49 -0600
committerRyan Mehri <[email protected]>2020-05-11 20:55:49 -0600
commit5f493fbdabad58412fba14b4c9534709d701192e (patch)
tree48f699ba5094f33aacf4649fab4d8b5f590ba7a4 /backend/hashing
parentAdd password check on post hash (diff)
downloadctrl-v-5f493fbdabad58412fba14b4c9534709d701192e.tar.xz
ctrl-v-5f493fbdabad58412fba14b4c9534709d701192e.zip
Rename good
Diffstat (limited to 'backend/hashing')
-rw-r--r--backend/hashing/hash.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/backend/hashing/hash.go b/backend/hashing/hash.go
index d8e699a..d4b2566 100644
--- a/backend/hashing/hash.go
+++ b/backend/hashing/hash.go
@@ -31,15 +31,15 @@ func HashPassword(password string) (string, error) {
return string(hashedPassword), err
}
-func ComparePasswords(dbPassword, gotPassword string) bool {
+func ComparePasswords(dbPassword, parsedPassword string) bool {
dbPassBytes := []byte(dbPassword)
- gotPassBytes := []byte(gotPassword)
- compErr := bcrypt.CompareHashAndPassword(dbPassBytes, gotPassBytes)
+ parsedPassBytes := []byte(parsedPassword)
+ compErr := bcrypt.CompareHashAndPassword(dbPassBytes, parsedPassBytes)
// if comparison error, the given password is not valid
- if compErr != nil {
- return false
- } else {
+ if compErr == nil {
return true
+ } else {
+ return false
}
} \ No newline at end of file