# Update email\_verified on password reset

**URL:** <https://community.auth0.com/t/update-email-verified-on-password-reset/9902>\
**Category:** Get Help\
**Created:** [March 9, 2018, 3:07am UTC](https://community.auth0.com/t/update-email-verified-on-password-reset/9902 "2018-03-09T03:07:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex.kuttner](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@alex.kuttner](https://community.auth0.com/u/alex.kuttner)\
**Post date:** [March 9, 2018, 3:07am UTC](https://community.auth0.com/t/update-email-verified-on-password-reset/9902/1 "2018-03-09T03:07:33Z")

</div>

How can we set the email\_verified to TRUE on successful password reset?  
Can do this with a patch request to /aip/v2/users/{id}, but how to run this after successful reset?

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [March 13, 2018, 7:46pm UTC](https://community.auth0.com/t/update-email-verified-on-password-reset/9902/2 "2018-03-13T19:46:40Z")

</div>

👋 @alex.kuttner

You could create a [Rule](https://auth0.com/docs/rules/current) to accomplish this. Are you using a custom database or Auth0? If you are using Auth0 databases this example code below, or you can grab it from our [GitHub](https://github.com/auth0/rules/blob/master/rules/verify-user-email-with-password-reset.md), will help you get the job done.

Do note that this will set `email_verified` to true only when the next successful login sequence happens after the password is reset.

```auto
function (user, context, callback) {
  var request = require('request@2.56.0');
  var userApiUrl = auth0.baseUrl + '/users/';
  
  if (context.connectionStrategy !== "auth0") {
    return callback(null, user, context);
  }

  if (!user.email_verified && user.last_password_reset) {
    request.patch({
      url: userApiUrl + user.user_id,
      headers: {
        Authorization: 'Bearer ' + auth0.accessToken
      },
      json: { "email_verified": true },
      timeout: 5000
    }, 
    function(err, response, body) {
      context.idToken.email_verified = true;

      return callback(null, user, context);
    });
  } else {
    return callback(null, user, context);
  }

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 25, 2019, 11:06am UTC](https://community.auth0.com/t/update-email-verified-on-password-reset/9902/3 "2019-07-25T11:06:03Z")

</div>


