From: Moritz Bunkus Date: Tue, 16 Jul 2013 11:07:27 +0000 (+0200) Subject: LoginScreen: im Check auf "schon angemeldet?" Client setzen X-Git-Tag: release-3.1.0beta1~161^2~46 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e06fdbe7cc20e4d79a788ca9bd28ba422f09ba47;p=kivitendo-erp.git LoginScreen: im Check auf "schon angemeldet?" Client setzen --- 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);