mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Meteor.loggingIn now true during the beginPasswordExchange part of
Meteor.loginWithPassword.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user