title: Custom Reset Email Page in Angular with Firebase Authentication
body: <p>I am trying to create a custom reset password page for my angular and firebase project. I have set the customized URL to localhost/resetpassword page while testing the page. But I am not able to reset password successfully.</p>
  
  <p>I am using ActivatedRoute to read the param values of mode, oobCode, continueUrl etc. Then I use confirmPassword with the auth object to get email and then confirm reset to set the password. Here is the TS code for my reset password component. I have a bunch of console.logs to get the issue. Here is the code.</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { NgForm } from '../../../../../node_modules/@angular/forms';
  import * as firebase from 'firebase';
  import { ActivatedRoute, Router } from '@angular/router';
  
  @Component({
    selector: 'app-reset-password-page',
    templateUrl: './reset-password-page.component.html',
    styleUrls: ['./reset-password-page.component.css']
  })
  export class ResetPasswordPageComponent implements OnInit {
    newPassword: string;
    mode: string;
    actionCode: string;
    continueUrl: string;
  
    constructor(
      private activatedRoute: ActivatedRoute,
      private router: Router
    ) { }
  
    ngOnInit() {
      console.log('In reset password');
      this.activatedRoute.queryParams.subscribe(params =&gt; {
        this.mode = params['mode'];
        this.actionCode = params['oobCode'];
        this.continueUrl = params['continueUrl'];
        console.log(this.mode);
        console.log(this.actionCode);
        console.log(this.continueUrl);
  
      });
  
    }
  
    resetPassword(form: NgForm) {
      var password_attempt1 = form.value.password_first_time;
      var password_attempt2 = form.value.password_second_time;
      console.log(password_attempt1);
      console.log(password_attempt2)
  
      if(password_attempt1 === password_attempt2) {
        console.log('Passed password check');
        this.getAllParameters(this.mode, this.actionCode, this.continueUrl);
  
      } else {
        console.log('PASSWORDS DO NOT MATCH');
        this.router.navigate(['/resetpassword']);
      }
  
    }
  
    getAllParameters(mode, actionCode, continueUrl) {
  
      var auth = firebase.auth();
      console.log(auth);
  
      switch (mode) {
        case 'resetPassword':
          // Display reset password handler and UI.
          this.handleResetPassword(auth, actionCode, continueUrl);
          break;
        default:
        // Error: invalid mode.
  
      }
    }
  
    handleResetPassword(auth, actionCode, continueUrl) {
      console.log('In handle reset password');
      var accountEmail;
      auth.verifyPasswordResetCode(actionCode).then(function (email) {
        accountEmail = email;
  
        auth.confirmPasswordReset(actionCode, this.newPassword).then(function (resp) {
          console.log('Password Reset');
          this.router.navigate(['/login']);
        }).catch(function (error) {
          console.log('ERROR IN PASSWORD RESET');
        });
  
      }).catch(function (error) {
        console.log('INVALID OR EXPIRED ACTION CODE');
      })
  
    }
  
  }
  </code></pre>
  
  <p>I expect password to reset and user is redirected to login page.</p>