Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. changePassword() {
  2.  
  3. if(this.passwordchangeForm.valid) {
  4.  
  5. this.auth.changePasswort(this.passwordnew.value, this.password.value).then(data=>{
  6. let toast = this.toastCtrl.create({
  7. message: "Passwort erfolgreich geändert",
  8.  
  9. })
  10. toast.present();
  11.  
  12. }).catch(error=>{
  13. let alert = this.alertCtrl.create({
  14. title: 'Fehler beim ändern des Passworts',
  15. message: error,
  16. buttons: ['OK']
  17. })
  18. alert.present();
  19.  
  20. })
  21. }
  22. }
  23.  
  24. changePasswort(passNew, password){
  25. var currUser = this.firebase.auth().currentUser;
  26. return new Promise((resolve, reject) =>{
  27. this.loginWithEmail({email: currUser.email, password: password}).subscribe(data =>{
  28. currUser.updatePassword(passNew).then(result =>{
  29. resolve("Passwort Updated")
  30. }).catch(error =>{
  31. reject(error)
  32. })
  33. }, error=>{
  34. reject(error);
  35. })
  36. })
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement