Skip to content

Commit

Permalink
Fixing logout for Chrome
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/ledger-smb/code/branches/1.3@6518 4979c152-3d1c-0410-bac9-87ea11338e46
  • Loading branch information
einhverfr committed Jan 18, 2014
1 parent 10081ed commit 8ed48c2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LedgerSMB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ sub new {
#HV why not trying _db_init also in case of login authenticate? quid logout-function?
if ($self->{script} eq 'login.pl' &&
($self->{action} eq 'authenticate' || $self->{action} eq '__default'
|| !$self->{action})){
|| !$self->{action} || ($self->{action} eq 'logout_js'))){
return $self;
}
if ($self->{script} eq 'setup.pl'){
Expand Down
2 changes: 1 addition & 1 deletion UI/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
if (agt.indexOf("msie") == -1) {
var xhre = new XMLHttpRequest() ;
xhre.open("GET",window.location,true,"logout","logout");
xhre.open("GET",'login.pl?action=logout_js',true,"logout","logout");
xhre.send("");
xhre.abort();
//be aware, sometimes get-request reaches server despite abort.
Expand Down
17 changes: 17 additions & 0 deletions scripts/login.pl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ sub logout {
$template->render($request);
}

=head2 logout_js
This is a stup for a js logout feature. It allows javascript to log out by
requiring only bogus credentials (logout:logout).
=cut

sub logout_js {
my $request = shift @_;
my $creds = LedgerSMB::Auth::get_credentials();
LedgerSMB::Auth::credential_prompt
unless ($creds->{password} eq 'logout')
and ($creds->{login} eq 'logout');
logout($request);
}


eval { do "scripts/custom/login.pl"};

=back
Expand Down

0 comments on commit 8ed48c2

Please sign in to comment.