Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a3339fc7

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID a3339fc75fd7c2fd1328e5444dcde255e4034f95
  • Vorgänger 670f76a8
  • Nachfolger 540c0b5e

User- und Adminlogin jederzeit via Formularfelder ermöglichen

Unterschiede anzeigen:

SL/Dispatcher/AuthHandler/Admin.pm
7 7
sub handle {
8 8
  %::myconfig = ();
9 9

  
10
  return if $::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK();
10
  return if  $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'})            == $::auth->OK());
11
  return if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK());
11 12

  
12 13
  $::auth->delete_session_value('admin_password');
13 14
  SL::Dispatcher::show_error('login/password_error', 'password', is_admin => 1);
SL/Dispatcher/AuthHandler/User.pm
5 5
use parent qw(Rose::Object);
6 6

  
7 7
sub handle {
8
  my $login = $::auth->get_session_value('login');
8
  my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login');
9 9
  SL::Dispatcher::show_error('login/password_error', 'password') if not defined $login;
10 10

  
11 11
  %::myconfig = $::auth->read_user(login => $login);
......
14 14

  
15 15
  $::locale = Locale->new($::myconfig{countrycode});
16 16

  
17
  SL::Dispatcher::show_error('login/password_error', 'password') if SL::Auth::OK != $::auth->authenticate($login, undef);
17
  my $ok   =  $::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, $::form->{'{AUTH}password'}));
18
  $ok    ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, undef));
19

  
20
  SL::Dispatcher::show_error('login/password_error', 'password') if !$ok;
18 21

  
19 22
  $::auth->create_or_refresh_session;
20 23
  $::auth->delete_session_value('FLASH');
21
  delete $::form->{password};
22 24
}
23 25

  
24 26
1;

Auch abrufbar als: Unified diff