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

Commit c434ffc

Browse files
author
jacobawenger
committed
Fully fixed the $logout() bug
1 parent 006135f commit c434ffc

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/firebaseSimpleLogin.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,11 @@
9494

9595
// Unauthenticate the Firebase reference.
9696
logout: function() {
97-
// Tell the simple login client to log us out.
98-
this._authClient.logout();
99-
100-
// Forget who we were immediately, so that any getCurrentUser() calls
101-
// will resolve the user as logged out even before the _onLoginEvent()
102-
// fires and resets this._currentUserData to null again.
103-
this._currentUserData = null;
97+
// Simple Login fires _onLoginEvent() even if no user is logged in. We don't care about
98+
// firing this logout event multiple times, so explicitly check if a user is defined.
99+
if (this._currentUserData) {
100+
this._authClient.logout();
101+
}
104102
},
105103

106104
// Creates a user for Firebase Simple Login. Function 'cb' receives an
@@ -195,14 +193,6 @@
195193

196194
// Internal callback for any Simple Login event.
197195
_onLoginEvent: function(err, user) {
198-
// HACK -- calls to logout() trigger events even if we're not logged in,
199-
// making us get extra events. Throw them away. This should be fixed by
200-
// changing Simple Login so that its callbacks refer directly to the
201-
// action that caused them.
202-
if (this._currentUserData === user && err === null) {
203-
return;
204-
}
205-
206196
var self = this;
207197
if (err) {
208198
if (self._loginDeferred) {

0 commit comments

Comments
 (0)