Skip to content

Commit

Permalink
passwords should be reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
dreth committed Oct 4, 2024
1 parent da3aaaa commit e0bc322
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions backend/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ func Register(c *gin.Context) {

// Hash the password to check for uniqueness
PasswordHash := encryption.HashStringWithSHA256(req.Password)
if exists, err = models.Users(models.UserWhere.PasswordHash.EQ(PasswordHash)).Exists(c, env.DB); helper.HE(c, err, http.StatusInternalServerError, "failed to check existing user", false) {
return
}
if exists {
c.JSON(http.StatusConflict, gin.H{"error": "password already registered"})
if _, err = models.Users(models.UserWhere.PasswordHash.EQ(PasswordHash)).Exists(c, env.DB); helper.HE(c, err, http.StatusInternalServerError, "failed to check existing user", false) {
return
}

Expand Down

0 comments on commit e0bc322

Please sign in to comment.