Skip to content

Commit

Permalink
fix(login-form): Login dialog not opening properly after external close.
Browse files Browse the repository at this point in the history
When the login dialog is closed by clicking on the backdrop, it was not properly removing the loginDialog object so the next time it failed to open the login form.
  • Loading branch information
petebacondarwin committed Apr 9, 2013
1 parent ef257e3 commit 88fa352
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions client/src/common/security/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ angular.module('security.service', [
// Login form dialog stuff
var loginDialog = null;
function openLoginDialog() {
if ( !loginDialog ) {
loginDialog = $dialog.dialog();
loginDialog.open('security/login/form.tpl.html', 'LoginFormController').then(onLoginDialogClose);
if ( loginDialog ) {
throw new Error('Trying to open a dialog that is already open!');
}
loginDialog = $dialog.dialog();
loginDialog.open('security/login/form.tpl.html', 'LoginFormController').then(onLoginDialogClose);
}
function closeLoginDialog(success) {
if (loginDialog) {
loginDialog.close(success);
loginDialog = null;
}
}
function onLoginDialogClose(success) {
loginDialog = null;
if ( success ) {
queue.retryAll();
} else {
Expand Down Expand Up @@ -108,4 +109,4 @@ angular.module('security.service', [
};

return service;
}]);
}]);

0 comments on commit 88fa352

Please sign in to comment.