Skip to content

Commit

Permalink
Fix dev no-code account verification
Browse files Browse the repository at this point in the history
  • Loading branch information
emmdim committed Oct 17, 2024
1 parent 2828a7b commit 2fcd020
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ func (a *API) verifyUserAccountHandler(w http.ResponseWriter, r *http.Request) {
ErrMalformedBody.Write(w)
return
}

// check the email and verification code are not empty
if verification.Email == "" || verification.Code == "" {
ErrInvalidUserData.With("no verification code or email provided").Write(w)
if (a.mail != nil || a.sms != nil) &&
(verification.Code == "" ||
(verification.Email == "" && verification.Phone == "") ||
(a.mail == nil && verification.Email != "") ||
(a.sms == nil && verification.Phone != "")) {
ErrInvalidUserData.With("no verification code or email/phone provided").Write(w)
return
}
// get the user information from the database by email
Expand Down

0 comments on commit 2fcd020

Please sign in to comment.