Auth0 change password using custom login

Viewed 361

In auth0 with the custom login form, I wanted to set it up in a way that when the user clicks on Forgot Password link it should redirect to send email page. And from there when the email is entered and clicked on submit a reset link should be sent to the email whereas clicking on the reset link should redirect to the change password page in auth0. With auth0 lock its already been setup but with custom login we have do it creating send email page where email would be entered and calling the change password function. Can someone help me out with how do I achieve it. Also should I have the change password function in the custom login page or in the send email page and should be called when send email button is hit. Have included auth0 changepassword function below.

function resetPassword (e) {
    e.preventDefault();
            var email = document.getElementById('email').value;
    if(!email)
    {
      alert("Please enter your email.");
      return;
    }
        webAuth.changePassword({
        connection: databaseConnection ,
        email:   email
            }, function (err, resp) {
        if(err){
            console.log(err.message);
        alert(err.message);
            }else{
            console.log(resp);
        alert(resp);
        }});
  }
1 Answers

So I found the answer to this question. In fact default auth0 custom login page is single page application. There we have to hide the elements and display other elements using javascript is preferable.

Related