From: Moritz Bunkus Date: Thu, 6 Jun 2013 14:44:38 +0000 (+0200) Subject: Admin-Auth-Handler: FLASH löschen (wie auch beim User) X-Git-Tag: release-3.1.0beta1~331^2~50 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=32b79fa8495846e993a7130fc9271ca39e2e6c44;p=kivitendo-erp.git Admin-Auth-Handler: FLASH löschen (wie auch beim User) --- diff --git a/SL/Dispatcher/AuthHandler/Admin.pm b/SL/Dispatcher/AuthHandler/Admin.pm index baacc67e3..babdc223a 100644 --- a/SL/Dispatcher/AuthHandler/Admin.pm +++ b/SL/Dispatcher/AuthHandler/Admin.pm @@ -10,15 +10,21 @@ sub handle { %::myconfig = (); - return 1 if $::auth->get_api_token_cookie; - return 1 if $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK()); - return 1 if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK()); - return 1 if $params{action} eq 'login'; + my $ok = $::auth->get_api_token_cookie ? 1 : 0; + $ok ||= $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK()); + $ok ||= !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK()); + $ok ||= $params{action} eq 'login'; - $::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin'); + $::auth->create_or_refresh_session; - $::auth->punish_wrong_login; + if ($ok) { + $::auth->delete_session_value('FLASH'); + return 1; + } + + $::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin'); $::auth->delete_session_value('admin_password'); + $::auth->punish_wrong_login; SL::Dispatcher::show_error('admin/adminlogin', 'password'); return 0;