CannabisData / cannabisdata

Cannabis Data monorepo
MIT License
8 stars 1 forks source link

Reset Password - fails #4

Open gregoryfoster opened 1 year ago

gregoryfoster commented 1 year ago

Settings -> User Settings -> Change your password Entering the email address here (which shouldn't really be required since it's on the profile) and selecting "Reset Password" results in an error.

auth.js:26 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'value')
    at Object.resetPassword (auth.js:26:60)
    at HTMLButtonElement.onclick (VM1334 password-reset:112:163)
keeganskeate commented 1 year ago

The main correction here was changing the login-email IDs to sign-in-email IDs in the reset password templates. A loading button and ID for the reset password button were also needed. Finally, a small script was added to populate the email input with the user's email if the user is already signed in.

<!-- JavaScript to get any signed-in user's email. -->
  <script>
    cannabisdata.firebase.onAuthChange(function(user) {
      if (user !== null) document.getElementById('sign-in-email').value = user.email;
    });
  </script>
gregoryfoster commented 1 year ago

Hmm, no error in console now, but a JS popup message is shown:

Password Reset Error Password reset email failed to send. Try again later.