Commit c0ee0d47 authored by Benjamin Rokseth's avatar Benjamin Rokseth Committed by Benjamin Rokseth
Browse files

timber: fix login and logout koha session

remove api user and retry
parent c6e8b93b
......@@ -24,7 +24,7 @@ sub login {
my $cgi = CGI->new;
$cgi->param(userid => $userid);
$cgi->param(password => $password);
my ($status, $session) = C4::Auth::check_api_auth($cgi);
my ($status, $cookie, $sessionid) = C4::Auth::check_api_auth($cgi);
$patron = Koha::Patrons->find({ userid => $userid }) unless $patron;
$patron = Koha::Patrons->find({ cardnumber => $userid }) unless $patron;
......@@ -35,9 +35,9 @@ sub login {
return $c->render(status => 403, json => { error => "Database is under maintenance." }) if $status eq "maintenance";
return $c->render(status => 403, json => { error => "Login failed." }) unless $status eq "ok";
$c->cookie('koha.session' => $session->{id}, { path => "/" });
$c->cookie('koha.session' => $sessionid, { path => "/" });
return $c->render(status => 201, json => $session );
return $c->render(status => 201, json => $patron );
}
sub logout {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment