Skip to content

Commit

Permalink
Merge pull request #15 from meteor-useraccounts/avoid-redirect
Browse files Browse the repository at this point in the history
fix avoidRedirect bug
  • Loading branch information
splendido committed Oct 1, 2015
2 parents febf432 + e21eb1c commit 712ddec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ AccountsTemplates.ensureSignedIn = function(context, redirect) {
});

// redirect settings
AccountsTemplates.avoidDefaultRedirect = true;
AccountsTemplates.avoidRedirect = true;
AccountsTemplates.avoidClearError = true;
AccountsTemplates.redirectToPrevPath = true;

Expand Down Expand Up @@ -93,7 +93,7 @@ AccountsTemplates.linkClick = function(route) {
return;
}
var path = AccountsTemplates.getRoutePath(route);
if (path === '#' || path === FlowRouter.current().path) {
if (path === '#' || AccountsTemplates.avoidRedirect || path === FlowRouter.current().path) {
AccountsTemplates.setState(route);
} else {
Meteor.defer(function() {
Expand Down Expand Up @@ -124,8 +124,8 @@ AccountsTemplates.logout = function() {
};

AccountsTemplates.postSubmitRedirect = function(route) {
if (AccountsTemplates.avoidDefaultRedirect) {
AccountsTemplates.avoidDefaultRedirect = false;
if (AccountsTemplates.avoidRedirect) {
AccountsTemplates.avoidRedirect = false;
if (AccountsTemplates.redirectToPrevPath) {
FlowRouter.redirect(AccountsTemplates.getPrevPath());
}
Expand Down

0 comments on commit 712ddec

Please sign in to comment.