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

Commit 878ca09

Browse files
author
Jacob Wenger
committed
Merge pull request #610 from whitneyit/feature/normalise-changeEmail-check
Normalise changeEmail check
2 parents e412fc1 + d7b4f8b commit 878ca09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/FirebaseAuth.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,14 @@
355355
* @return {Promise<>} An empty promise fulfilled once the email change is complete.
356356
*/
357357
changeEmail: function(credentials) {
358+
var deferred = this._q.defer();
359+
358360
if (typeof this._ref.changeEmail !== 'function') {
361+
throw new Error("$firebaseAuth.$changeEmail() requires Firebase version 2.1.0 or greater.");
362+
} else if (typeof credentials === 'string') {
359363
throw new Error("$changeEmail() expects an object containing 'oldEmail', 'newEmail', and 'password', but got a string.");
360364
}
361365

362-
var deferred = this._q.defer();
363-
364366
try {
365367
this._ref.changeEmail(credentials, this._utils.makeNodeResolver(deferred));
366368
} catch (error) {

0 commit comments

Comments
 (0)