1 package SL::Controller::LoginScreen;
5 use parent qw(SL::Controller::Base);
7 use SL::Dispatcher::AuthHandler::User;
14 sub action_user_login {
17 $self->render('login_screen/user_login');
23 $::auth->destroy_session;
24 $::auth->create_or_refresh_session;
25 $self->render('login_screen/user_login', error => $::locale->text('You are logged out!'));
31 %::myconfig = $::form->{'{AUTH}login'} ? $::auth->read_user(login => $::form->{'{AUTH}login'}) : ();
32 %::myconfig = SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode});
33 $::form->{login} = $::myconfig{login};
34 $::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
35 my $user = User->new(login => $::myconfig{login});
37 # if we get an error back, bale out
38 my $result = $user->login($::form);
40 # Database update available?
41 ::end_of_request() if -2 == $result;
43 # Auth DB needs update? If so log the user out forcefully.
45 $::auth->destroy_session;
46 return $self->render('login_screen/auth_db_needs_update');
51 $::auth->punish_wrong_login;
52 return $self->render('login_screen/user_login', error => $::locale->text('Incorrect username or password!'));
56 $::auth->set_cookie_environment_variable();
58 return $self->redirect_to($::form->{callback}) if $::form->{callback};
60 my %style_to_script_map = (
66 my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
68 $self->redirect_to(controller => "menu${menu_script}.pl", action => 'display');
78 sub keep_auth_vars_in_form {