Auth0 Home Blog Docs

Regarding verification email

Hi, Regarding the reset password, we were using the ‘url’ which is in the verification email template for reset password. In our case we allow user to create with or without password. So in the verification email template we have checked if the password is set and change the ‘url’ accordingly. This was working fine before. Now this scenario is not working.Can anybody help us ?

Verification email template
{% if user.user_metadata.password_set == 1 %}
Verify
Account

{% else %}
Set your password
{% endif %}

On current case verification works fine but reset causing some error page saying unauthorized…

Hello @demo7300,

Welcome to the Community!

Can you post the actual content from your email template? How are you creating the verification and reset password links?

4 Likes
<html>
    <head></head>
    <body>
        <div>
            <p style="font-size:11pt;font-family:'Calibri',sans-serif;">Hi {{ user.user_metadata.first_name }},</p> 
            <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 4px;">Welcome to your cybersecurity program portal!</p>
            <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 4px;">Your path to cybersecurity automation starts here!</p>
            {% if user.user_metadata.password_set == 1 %}
                <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 5px;">Please click on the link below to verify your account.</p>
                <div style="background:#00b050;padding:6px 0px;width: 100px;text-align: center; mso-hide:all;">
                    <a target='_blank' href='{{ url }}' style='color:#ffffff;text-decoration: none;'>Verify <br/>Account</a>
                </div>
                <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 3px;">To easily log in later, save this URL:
                <br/><a target='_blank' href='{{user.user_metadata.home_url}}'>{{ user.user_metadata.home_url }}</a></p>
                <!--[if mso]>
                    <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ url }}" style="height:52px;v-text-anchor:middle;width:80px;" arcsize="1%" strokecolor="#00b050" fillcolor="#00b050">
                        <w:anchorlock/>
                        <center style="color:#ffffff;font-family:Arial,sans-serif;font-size:12px;">Verify <br/>Account</center>
                    </v:roundrect>
                <![endif]-->
            {% else %}
                <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 5px;">Please follow the URL below to set your password.</p>
                <div style="background:#00b050;padding:12px 12px;width: 148px;text-align: center; mso-hide:all;">
                    <a target='_blank' href="{{ url | replace:'u/email-verification','lo/reset'}}" style='color:#ffffff;text-decoration: none;'>Set your password</a>
                </div>
                <!--[if mso]>
                    <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ url | replace:'verify_email','reset'}}" style="height:45px;v-text-anchor:middle;width:148px;" arcsize="1%" strokecolor="#00b050" fillcolor="#00b050">
                        <w:anchorlock/>
                        <center style="color:#ffffff;font-family:Arial,sans-serif;font-size:12px;">Set your password</center>
                    </v:roundrect>
                <![endif]-->
            {% endif %}
            <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 8px;">Again, welcome to Apptega!</p>
            <p style="font-size:11pt;font-family:'Calibri',sans-serif;padding-top: 4px;">Best Regards,<br/>The Apptega Team</p>
        </div>
    </body>
</html>

Please help us :frowning:

Hi @demo7300,

I’m definitely not an expert with the email templates … what you have there looks ok to me. Typically a 401 means your token / session is not valid, or not valid for the API endpoint you are trying to call. I would suggest collecting a HAR file and either posting it here or opening a support ticket to have it looked at.