]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Controller/LoginScreen.pm
Vor Fremdschlüsselzuweisung trans_id verwaiste Einträge in orderitems löschen
[kivitendo-erp.git] / SL / Controller / LoginScreen.pm
index 9d0e94bc3bf56a0a450af97eab2679371ea170ce..81ad8dd5c8143098f85ddef6839e5a7d2788ae8b 100644 (file)
@@ -7,6 +7,7 @@ use parent qw(SL::Controller::Base);
 use SL::Dispatcher::AuthHandler::User;
 use SL::User;
 
+__PACKAGE__->run_before('set_layout');
 #
 # actions
 #
@@ -33,12 +34,13 @@ sub action_logout {
 sub action_login {
   my ($self) = @_;
 
-  %::myconfig      = $::form->{'{AUTH}login'} ? $::auth->read_user(login => $::form->{'{AUTH}login'}) : ();
-  %::myconfig      = SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode});
+  my $login        = $::form->{'{AUTH}login'} || $::auth->get_session_value('login');
+  %::myconfig      = $login ? $::auth->read_user(login => $login) : ();
+  SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode});
   $::form->{login} = $::myconfig{login};
   $::locale        = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
   my $user         = User->new(login => $::myconfig{login});
-  $::request->{layout} = SL::Controller::Layout->new(style => $user->{menustyle});
+  $::request->{layout} = SL::Layout::Dispatcher->new(style => $user->{menustyle});
 
   # if we get an error back, bale out
   my $result = $user->login($::form);
@@ -116,4 +118,8 @@ sub error_state {
   }->{$_[0]};
 }
 
+sub set_layout {
+  $::request->{layout} = SL::Layout::Dispatcher->new(style => 'login');
+}
+
 1;