Skip to content

Commit

Permalink
Merge branch 'develop' into feature/Web/Hourly-Predictions-and-Recomm…
Browse files Browse the repository at this point in the history
…endations
  • Loading branch information
Rethakgetse-Manaka committed Sep 26, 2024
2 parents c5e13fe + fceed30 commit 97d3c14
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion occupi-backend/pkg/handlers/auth_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ func BeginLoginAdmin(ctx *gin.Context, appsession *models.AppSession) {
http.StatusOK,
"Error getting user credentials, please register for WebAuthn",
gin.H{"error": "Error getting user credentials, please register for WebAuthn"}))
fmt.Printf("error getting user credentials: %v", err)
return
}
webauthnUser := models.NewWebAuthnUser([]byte(requestEmail.Email), requestEmail.Email, requestEmail.Email, cred)
Expand Down
12 changes: 1 addition & 11 deletions occupi-backend/pkg/handlers/auth_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ func PreLoginAccountChecks(ctx *gin.Context, appsession *models.AppSession, emai
return false, err
}

if !verified {
ctx.JSON(http.StatusBadRequest, utils.ErrorResponse(
http.StatusBadRequest,
"Not verified",
constants.IncompleteAuthCode,
"Please verify your email before logging in",
nil))
return false, nil
}

// check if the user is an admin
if role == constants.Admin {
isAdmin, err := database.CheckIfUserIsAdmin(ctx, appsession, email)
Expand Down Expand Up @@ -392,7 +382,7 @@ func PreLoginAccountChecks(ctx *gin.Context, appsession *models.AppSession, emai
}

switch {
case isVerificationDue:
case isVerificationDue, !verified:
// update verification status in database to false
_, err = database.UpdateVerificationStatusTo(ctx, appsession, email, false)
if err != nil {
Expand Down

0 comments on commit 97d3c14

Please sign in to comment.