Browse files

Meteor.loggingIn now true during the beginPasswordExchange part of

Meteor.loginWithPassword.
  • Loading branch information...
1 parent 3b97c91 commit 738e8f43faeec797dddce2fcd73a1f22cdb2351f @glasser glasser committed Nov 20, 2012
Showing with 16 additions and 5 deletions.
  1. +10 −5 packages/accounts-base/accounts_client.js
  2. +6 −0 packages/accounts-password/password_client.js
View
15 packages/accounts-base/accounts_client.js
@@ -7,9 +7,14 @@
var loggingIn = false;
var loggingInListeners = new Meteor.deps._ContextSet;
- var setLoggingIn = function (x) {
- loggingIn = x;
- loggingInListeners.invalidateAll();
+ // This is mostly just called within this file, but Meteor.loginWithPassword
+ // also uses it to make loggingIn() be true during the beginPasswordExchange
+ // method call too.
+ Accounts._setLoggingIn = function (x) {
+ if (loggingIn !== x) {
+ loggingIn = x;
+ loggingInListeners.invalidateAll();
+ }
};
Meteor.loggingIn = function () {
loggingInListeners.addCurrentContext();
@@ -109,7 +114,7 @@
if (reconnected)
return;
- setLoggingIn(false);
+ Accounts._setLoggingIn(false);
if (error || !result) {
error = error || new Error(
"No result from call to " + options.methodName);
@@ -128,7 +133,7 @@
options.userCallback();
};
- setLoggingIn(true);
+ Accounts._setLoggingIn(true);
Meteor.apply(
options.methodName,
options.methodArguments,
View
6 packages/accounts-password/password_client.js
@@ -35,8 +35,14 @@
request.user = selector;
+ // Normally, we only set Meteor.loggingIn() to true within
+ // Accounts.callLoginMethod, but we'd also like it to be true during the
+ // password exchange. So we set it to true here, and clear it on error; in
+ // the non-error case, it gets cleared by callLoginMethod.
+ Accounts._setLoggingIn(true);
Meteor.apply('beginPasswordExchange', [request], function (error, result) {
if (error || !result) {
+ Accounts._setLoggingIn(false);
error = error || new Error("No result from call to beginPasswordExchange");
callback && callback(error);
return;

0 comments on commit 738e8f4

Please sign in to comment.