add another check before generating a token for the used email
This commit is contained in:
@@ -228,7 +228,13 @@ func GoogleCallback(w http.ResponseWriter, r *http.Request) {
|
||||
helper.RespondWithError(w, http.StatusBadGateway, "Error checking email in database")
|
||||
return
|
||||
}
|
||||
helper.LogError(fmt.Errorf("%v", emailExists), "Email exists in DB")
|
||||
|
||||
if !emailExists {
|
||||
helper.LogError(errors.New("email not found"), "Email not registered: "+email)
|
||||
helper.RespondWithError(w, http.StatusUnauthorized, "Email not registered. Please contact the administrator.")
|
||||
return
|
||||
}
|
||||
|
||||
accessToken, refreshToken, err := GenerateTokens(email, userAgent, ipAddress)
|
||||
if err != nil {
|
||||
helper.LogError(err, "Error generating access token")
|
||||
|
||||
Reference in New Issue
Block a user