Angularfire auth verifyPasswordReset не существует для типа User - PullRequest
0 голосов
/ 17 марта 2019

Я пытаюсь реализовать функцию сброса пароля с помощью класса angularfire2 / auth, следуя приведенной здесь реализации: https://medium.com/@c_innovative/implementing-password-reset-can-be-a-tricky-but-inevitable-task-737badfb7bab

Мой код в основном такой же, как показано ниже: но я получаю ошибку

«Свойство verifyPasswordReset» не существует для типа «Наблюдаемый (Пользователь)»

handleResetPassword() { 

     if (this.newPassword != this.confirmPassword) { 
       this.matSnackBar.open("Passwords do not match.", null, { duration: 4000 }); 
       return; 
     } 

     // Save the new password. 
     this.authService.getAuth().confirmPasswordReset(
       this.actionCode, 
       this.newPassword
     ).then(resp => { 
       // Password reset has been confirmed and new password updated.    
       alert('New password has been saved');
       this.router.navigate(['/login']); }).catch(e => { 
         // Error occurred during confirmation. The code might have
         // expired or the password is too weak. alert(e); 
       }); 
     }

Если не использовать обходной путь REST, кто-нибудь знает, почему этот метод аутентификации angularFire, похоже, не работает? это должна быть допустимая функция для объекта auth.

1 Ответ

0 голосов
/ 18 марта 2019

Вы должны использовать @ angular / fire / auth

  1. Вставьте AngularFireAuth в ваш конструктор
  2. Из вашего метода handleResetPassword используйте введенное свойство

     import { AngularFireAuth } from '@angular/fire/auth';
    
     @Injectable({
      providedIn: 'root'
     })
     export class UserService {
    
       constructor(private fbAuth: AngularFireAuth) {}
    
       handleResetPassword() {
          // call comfirmPasswordReset method like this
      this.fbAuth.auth.confirmPasswordReset(this.actionCode,this.newPassword) 
       }
     }
    
...