Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dc50b737

Von Sven Schöling vor mehr als 14 Jahren hinzugefügt

  • ID dc50b737f80c8bd09ac2fbbfa2cc06a04e9d8753
  • Vorgänger eb69ed59
  • Nachfolger e9238b7d

fcgi patch test

Conflicts:

am.pl
bin/mozilla/oe.pl

Unterschiede anzeigen:

bin/mozilla/login.pl
37 37

  
38 38
use strict;
39 39

  
40
# This is required because the am.pl in the root directory
41
# is not scanned by locales.pl:
42
# $form->parse_html_template('login/password_error')
40
our $cgi;
41
our $form;
42
our $locale;
43
our $auth;
43 44

  
44
our $form = new Form;
45
sub run {
46
  $::lxdebug->enter_sub;
47
  my $session_result = shift;
45 48

  
46
if (! -f 'config/authentication.pl') {
47
  show_error('login/authentication_pl_missing');
48
}
49

  
50
our $locale = new Locale $main::language, "login";
51

  
52
our $auth = SL::Auth->new();
53
if (!$auth->session_tables_present()) {
54
  show_error('login/auth_db_unreachable');
55
}
56
$auth->expire_sessions();
57
my $session_result = $main::auth->restore_session();
58

  
59
# customization
60
if (-f "bin/mozilla/custom_$form->{script}") {
61
  eval { require "bin/mozilla/custom_$form->{script}"; };
62
  $form->error($@) if ($@);
63
}
64

  
65
# per login customization
66
if (-f "bin/mozilla/$form->{login}_$form->{script}") {
67
  eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
68
  $form->error($@) if ($@);
69
}
70

  
71
# window title bar, user info
72
$form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}";
73

  
74
if (SL::Auth::SESSION_EXPIRED == $session_result) {
75
  $form->{error_message} = $locale->text('The session is invalid or has expired.');
76
  login_screen();
77
  exit;
78
}
79

  
80
my $action = $form->{action};
49
  $cgi    = $::cgi;
50
  $form   = $::form;
51
  $locale = $::locale;
52
  $auth   = $::auth;
81 53

  
82
if (!$action && $auth->{SESSION}->{login}) {
83
  $action = 'login';
84
}
85

  
86
if ($action) {
87
  our %myconfig = $auth->read_user($form->{login}) if ($form->{login});
54
  $form->{stylesheet} = "lx-office-erp.css";
55
  $form->{favicon}    = "favicon.ico";
88 56

  
89
  if (!$myconfig{login} || (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0))) {
90
    $form->{error_message} = $locale->text('Incorrect Password!');
57
  if (SL::Auth::SESSION_EXPIRED == $session_result) {
58
    $form->{error_message} = $locale->text('The session is invalid or has expired.');
91 59
    login_screen();
92 60
    exit;
93 61
  }
62
  my $action = $form->{action};
63
  if (!$action && $auth->{SESSION}->{login}) {
64
    $action = 'login';
65
  }
66
  if ($action) {
67
    our %myconfig = $auth->read_user($form->{login}) if ($form->{login});
68

  
69
    if (!$myconfig{login} || (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0))) {
70
      $form->{error_message} = $locale->text('Incorrect Password!');
71
      login_screen();
72
    } else {
73
      $auth->set_session_value('login', $form->{login}, 'password', $form->{password});
74
      $auth->create_or_refresh_session();
75

  
76
      $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}";
77
      call_sub($locale->findsub($action));
78
    }
79
  } else {
80
    login_screen();
81
  }
94 82

  
95
  $auth->set_session_value('login', $form->{login}, 'password', $form->{password});
96
  $auth->create_or_refresh_session();
97

  
98
  $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}";
99
  call_sub($locale->findsub($action));
100

  
101
} else {
102
  login_screen();
83
  $::lxdebug->leave_sub;
103 84
}
104 85

  
105
1;
106

  
107 86
sub login_screen {
108 87
  $main::lxdebug->enter_sub();
109 88
  my ($msg) = @_;
......
147 126
  my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
148 127

  
149 128
  # made it this far, execute the menu
150
  $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback}));
129
  # standard redirect does not seem to work for this invocation, (infinite loops?)
130
  # do a manual invocation instead
131
#  $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback}));
151 132

  
152 133
  $main::auth->set_cookie_environment_variable();
153 134

  
154
  $form->redirect();
135
  $::form->{script}   = "menu${menu_script}.pl";
136
  $::form->{action}   = 'display';
137
  $::form->{callback} = $::form->escape($::form->{callback});
138

  
139
  require "bin/mozilla/$::form->{script}";
140
  display();
141

  
142
#  $form->redirect();
155 143

  
156 144
  $main::lxdebug->leave_sub();
157 145
}
......
203 191
  exit;
204 192
}
205 193

  
194
1;
195

  
196
__END__

Auch abrufbar als: Unified diff