diff --git a/REST-Tests/users.http b/REST-Tests/users.http index e8c066faf..2f3ca6ff7 100644 --- a/REST-Tests/users.http +++ b/REST-Tests/users.http @@ -47,7 +47,7 @@ Content-Type: application/json Accept: application/json { - "token": "cqucJFxaTBwEZfuQATIBouCvpAfVUWXvrinRXSZpWpxikBMKyBtfNsZysvKOwCPMTsfmHZZeXiHhdBQyAUHFkMiXFAKqzMTWpTTJLkVeoKSkoinlsnxuPiqXjOHJNhnihRtRTdpQARQBlGHBrppojIJwZdKtmXsxwqMDwYKiTuHwjaOKYLeMLQaEWYpmedfvjtwSqhfuitguIatvLbVmtMfEAgwTcHscGeHpPsHFhLMXDqzwCmJYqsXoXxaumMaqaGOTguwvpWXCfvfBSXsjqiTwOcxhdYTRvQNoHijYkzshmrPDwiQcMNyCRzenxaKcrrVPcxJMmMGffjkRQlMtzUyBuHbHLbwQRaadLqPWuKJdXKSjMGiIFzyhCTzOSzMXgSCBtIfRFQaqsUss" + "token": "" } ### diff --git a/pkg/models/user_email_confirm.go b/pkg/models/user_email_confirm.go index a9c177ee0..abe23e441 100644 --- a/pkg/models/user_email_confirm.go +++ b/pkg/models/user_email_confirm.go @@ -8,6 +8,12 @@ type EmailConfirm struct { // UserEmailConfirm handles the confirmation of an email address func UserEmailConfirm(c *EmailConfirm) (err error) { + // Check if we have an email confirm token + if c.Token == "" { + return ErrInvalidEmailConfirmToken{} + } + + // Check if the token is valid user := User{} has, err := x.Where("email_confirm_token = ?", c.Token).Get(&user) if err != nil {