Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 477f871

Browse files
committed
Merge pull request #34 from sfeast/changeEmail
Adding new changeEmail function for password provider user accounts
2 parents ce9d993 + 2a817a9 commit 477f871

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

firebase-login.html

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
/**
307307
* Changes the password of a "password provider"-based user account.
308308
*
309-
* If the operation is successful, the `user-created` event is fired.
309+
* If the operation is successful, the `password-changed` event is fired.
310310
*
311311
* If the operation fails, the `error` event is fired, with `e.detail`
312312
* containing error information supplied from Firebase.
@@ -333,7 +333,7 @@
333333
/**
334334
* Sends a password reset email for a "password provider"-based user account.
335335
*
336-
* If the operation is successful, the `user-created` event is fired.
336+
* If the operation is successful, the `password-reset` event is fired.
337337
*
338338
* If the operation fails, the `error` event is fired, with `e.detail`
339339
* containing error information supplied from Firebase.
@@ -351,10 +351,37 @@
351351
}.bind(this));
352352
},
353353

354+
/**
355+
* Changes the email of a "password provider"-based user account.
356+
*
357+
* If the operation is successful, the `email-changed` event is fired.
358+
*
359+
* If the operation fails, the `error` event is fired, with `e.detail`
360+
* containing error information supplied from Firebase.
361+
*
362+
* @method changeEmail
363+
* @param {string} oldEmail
364+
* @param {string} newEmail
365+
* @param {string} Password
366+
*/
367+
changeEmail: function(oldEmail, newEmail, password) {
368+
this.ref.changeEmail({
369+
oldEmail: oldEmail,
370+
newEmail: newEmail,
371+
password: password
372+
}, function(error) {
373+
if (!error) {
374+
this.fire('email-changed');
375+
} else {
376+
this.fire('error', error);
377+
}
378+
}.bind(this));
379+
},
380+
354381
/**
355382
* Removes a "password provider"-based user account.
356383
*
357-
* If the operation is successful, the `user-created` event is fired.
384+
* If the operation is successful, the `user-removed` event is fired.
358385
*
359386
* If the operation fails, the `error` event is fired, with `e.detail`
360387
* containing error information supplied from Firebase.

0 commit comments

Comments
 (0)