From 2fcd0206b76f9a8c8ab91e55945d2b92313752a3 Mon Sep 17 00:00:00 2001 From: emmdim Date: Thu, 17 Oct 2024 11:53:11 +0200 Subject: [PATCH] Fix dev no-code account verification --- api/users.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/users.go b/api/users.go index ae25bad..dfae062 100644 --- a/api/users.go +++ b/api/users.go @@ -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