Revision 22efd8a7
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/Controller/LoginScreen.pm | ||
---|---|---|
14 | 14 |
sub action_user_login { |
15 | 15 |
my ($self) = @_; |
16 | 16 |
|
17 |
# If the user is already logged in then redirect to the proper menu |
|
18 |
# script. |
|
19 |
return if $self->_redirect_to_main_script_if_already_logged_in; |
|
20 |
|
|
21 |
# Otherwise show the login form. |
|
17 | 22 |
$self->render('login_screen/user_login'); |
18 | 23 |
} |
19 | 24 |
|
... | ... | |
55 | 60 |
# Everything is fine. |
56 | 61 |
$::auth->set_cookie_environment_variable(); |
57 | 62 |
|
63 |
$self->_redirect_to_main_script($user); |
|
64 |
} |
|
65 |
|
|
66 |
# |
|
67 |
# settings |
|
68 |
# |
|
69 |
sub get_auth_level { |
|
70 |
return 'none'; |
|
71 |
} |
|
72 |
|
|
73 |
sub keep_auth_vars_in_form { |
|
74 |
return 1; |
|
75 |
} |
|
76 |
|
|
77 |
# |
|
78 |
# private methods |
|
79 |
# |
|
80 |
|
|
81 |
sub _redirect_to_main_script { |
|
82 |
my ($self, $user) = @_; |
|
83 |
|
|
58 | 84 |
return $self->redirect_to($::form->{callback}) if $::form->{callback}; |
59 | 85 |
|
60 | 86 |
my %style_to_script_map = ( |
... | ... | |
68 | 94 |
$self->redirect_to(controller => "menu${menu_script}.pl", action => 'display'); |
69 | 95 |
} |
70 | 96 |
|
71 |
# |
|
72 |
# settings |
|
73 |
# |
|
74 |
sub get_auth_level { |
|
75 |
return 'none'; |
|
76 |
} |
|
97 |
sub _redirect_to_main_script_if_already_logged_in { |
|
98 |
my ($self) = @_; |
|
99 |
|
|
100 |
# Get 'login' from valid session. |
|
101 |
my $login = $::auth->get_session_value('login'); |
|
102 |
return unless $login; |
|
103 |
|
|
104 |
# See whether or not the user exists in the database. |
|
105 |
my %user = $::auth->read_user(login => $login); |
|
106 |
return if ($user{login} || '') ne $login; |
|
107 |
|
|
108 |
# Check if the session is logged in correctly. |
|
109 |
return if SL::Auth::OK() != $::auth->authenticate($login, undef); |
|
110 |
|
|
111 |
$::auth->create_or_refresh_session; |
|
112 |
$::auth->delete_session_value('FLASH'); |
|
113 |
|
|
114 |
$self->_redirect_to_main_script(\%user); |
|
77 | 115 |
|
78 |
sub keep_auth_vars_in_form { |
|
79 | 116 |
return 1; |
80 | 117 |
} |
81 | 118 |
|
Auch abrufbar als: Unified diff
Login-Maske: Zu Menu redirecten falls bereits eingeloggt
Wenn man bereits eingeloggt ist und irgendwo im Programm zu login.pl
redirectet wird (z.B. beim Speichern der Benutzereinstellungen), so
wurde durch die Umstellung des Loginmechanismusses neulich leider die
Loginmaske erneut angezeigt, obwohl eine anständig authentifizierte
Session vorliegt.