kivitendo/SL/Dispatcher/AuthHandler/Admin.pm @ 738fb45b
6afd06ad | Moritz Bunkus | package SL::Dispatcher::AuthHandler::Admin;
|
||
use strict;
|
||||
use parent qw(Rose::Object);
|
||||
b6fd15a8 | Sven Schöling | use SL::Layout::Dispatcher;
|
||
4a12c839 | Sven Schöling | |||
6afd06ad | Moritz Bunkus | sub handle {
|
||
%::myconfig = ();
|
||||
6c21fd13 | Moritz Bunkus | return 1 if $::auth->get_api_token_cookie;
|
||
0e451e1b | Moritz Bunkus | 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());
|
||||
6afd06ad | Moritz Bunkus | |||
b6fd15a8 | Sven Schöling | $::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin');
|
||
4a12c839 | Sven Schöling | |||
540c0b5e | Moritz Bunkus | $::auth->punish_wrong_login;
|
||
670f76a8 | Moritz Bunkus | $::auth->delete_session_value('admin_password');
|
||
540c0b5e | Moritz Bunkus | SL::Dispatcher::show_error('admin/adminlogin', 'password');
|
||
0e451e1b | Moritz Bunkus | |||
return 0;
|
||||
6afd06ad | Moritz Bunkus | }
|
||
1;
|