fix: check if email or token is empty
This commit is contained in:
parent
4c2baf164f
commit
12a9ad28fd
|
@ -5,6 +5,7 @@ import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
"embed"
|
"embed"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
"errors"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -164,6 +165,11 @@ func (a AccountAPI) verifyEmail(jc jape.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if request.Email == "" || request.Token == "" {
|
||||||
|
_ = jc.Error(errors.New("invalid request"), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := a.accounts.VerifyEmail(request.Email, request.Token)
|
err := a.accounts.VerifyEmail(request.Email, request.Token)
|
||||||
|
|
||||||
if jc.Check("failed to verify email", err) != nil {
|
if jc.Check("failed to verify email", err) != nil {
|
||||||
|
|
Loading…
Reference in New Issue