X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FLoginScreen.pm;h=e84a31505ddb1b1cf80b12a0a3c1bbee6228283d;hb=267374ef8d99b9b802be53d07330d2fcb1886284;hp=ba10984395430e76169fc9d457921a5284c5397c;hpb=0f0779ce0add758d61cf0ff328134e9e83d0d751;p=kivitendo-erp.git diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index ba1098439..e84a31505 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -129,6 +129,19 @@ sub _redirect_to_main_script_if_already_logged_in { my %user = $::auth->read_user(login => $login); return if ($user{login} || '') ne $login; + # Check if there's a client set in the session -- and whether or not + # the user still has access to the client. + my $client_id = $::auth->get_session_value('client_id'); + return if !$client_id; + + if (!$::auth->set_client($client_id)) { + $::auth->punish_wrong_login; + $::auth->destroy_session; + $::auth->create_or_refresh_session; + $self->show_login_form(error => t8('Incorrect username or password or no access to selected client!')); + return 1; + } + # Check if the session is logged in correctly. return if SL::Auth::OK() != $::auth->authenticate($login, undef);