If I want to implement email verification required...
# support-questions-legacy
b
If I want to implement email verification required on my own UI, is there an API endpoint I can use to determine if user email is verified or not after signing in? How can i do this safely without exposing a public endpoint that arbitary tells if user email is verified or not
n
Hi @bladerpc Which frontend SDK are you using?
b
supertokens react
we have to use our own forms though
n
So the email verification recipe should have a function you can use to check if an email is verified
Ah found this
What is the default path for "verify email" on frontend?
n
/auth/verify
Assuming you used
/auth
as the website domain (or used the default by passing nothing for website domain)
@bladerpc Sorry the default is
/auth/verify-email
b
Do i need to expose an API endpoint to get the user's email address from the unverified session, or is it possible to do on frontend
n
The function should use the current session so you should not need to fetch any additional information
Also if you have a session then the link you sent earlier is the best way to protect pages
But to answer your question, you would need to expose an API to get the user's email from a session yes (verified or unverified)
b
session context has user email?
or just user id
n
Just user id
b
Got it
@nkshah2 any idea on golang backend how i can check if the user email is verified?
n
The email verification recipe exposes a function
IsEmailVerified
You can use that
You can pass just the user id or both user id and email to it
b
I'm trying to override the email verification template but it's not working
I notice email verification typeinput has email delivery
i have to define that twice? one for third party and one for emailverification?
ok that wasn't too bad
I think I might've found a bug.
I have this override:
Copy code
go
    if input.EmailVerification != nil {
                        verifyEmailLink := strings.Replace(input.EmailVerification.EmailVerifyLink, "/login", "", 1)
                        verifyEmailLink = strings.Replace(verifyEmailLink, "verify-email", "verify-email-confirm", 1)
                        var emailBody string
                        emailTemplate, err := email.GetEmailTemplate(email.VerifyEmailPath, map[string]string{
                            "VerifyEmailLink": verifyEmailLink,
                            "CurrentYear":     fmt.Sprintf("%d", time.Now().Year()),
                        })
                        if err != nil {
                            logger.Sugar().Error("Failed to retrieve verify email template template", "err", err)
                            emailBody = verifyEmailLink
                        } else {
                            emailBody = emailTemplate
                        }
                        user := input.EmailVerification.User
                        return emaildelivery.EmailContent{
                            Subject: "....",
                            Body:    emailBody,
                            IsHtml:  true,
                            ToEmail: user.Email,
                        }, nil

                    }
auth/user/email/verify/token error 500 returns
should never come here
when sending out email verification email
going to try 10.12.6, going to try sdk 10.12.7, do you see a problem with this @nkshah2
n
Hmm you mind creating a separate thread for this one? This one has a lot of context to consume
b
sure