fix: check if email or token is empty

This commit is contained in:
Derrick Hammer 2024-03-26 17:04:16 -04:00
parent 4c2baf164f
commit 12a9ad28fd
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"crypto/ed25519"
"embed"
_ "embed"
"errors"
"io/fs"
"net/http"
"strings"
@ -164,6 +165,11 @@ func (a AccountAPI) verifyEmail(jc jape.Context) {
return
}
if request.Email == "" || request.Token == "" {
_ = jc.Error(errors.New("invalid request"), http.StatusBadRequest)
return
}
err := a.accounts.VerifyEmail(request.Email, request.Token)
if jc.Check("failed to verify email", err) != nil {