]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Dispatcher/AuthHandler/Admin.pm
Admin: Teile von admin.pl in neuen Controller Admin verschoben; Mandanten anzeigen
[mfinanz.git] / SL / Dispatcher / AuthHandler / Admin.pm
index 7b194ff04f9aa50453f2c6e0158d76fea5883e22..baacc67e357556f6c4ce9f5cac265f8a6722ec7a 100644 (file)
@@ -1,16 +1,27 @@
 package SL::Dispatcher::AuthHandler::Admin;
 
 use strict;
-
 use parent qw(Rose::Object);
 
+use SL::Layout::Dispatcher;
+
 sub handle {
+  my ($self, %params) = @_;
+
   %::myconfig = ();
 
-  return if $::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK();
+  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';
 
+  $::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin');
+
+  $::auth->punish_wrong_login;
   $::auth->delete_session_value('admin_password');
-  SL::Dispatcher::show_error('login/password_error', 'password', is_admin => 1);
+  SL::Dispatcher::show_error('admin/adminlogin', 'password');
+
+  return 0;
 }
 
 1;