Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8c7e4493

Von Moritz Bunkus vor fast 17 Jahren hinzugefügt

  • ID 8c7e44938a661e035f62840e1e177353240ace5d
  • Vorgänger 3ced230b
  • Nachfolger ce45d060

Umstellung der Benutzerverwaltung von Dateien im Verzeichnis "users" auf die Verwendung einer Authentifizierungsdatenbank.
Es ist erforderlich, die Dateien doc/UPGRADE und doc/INSTALL/index.html zu lesen und die angesprochenen Punkte auszuführen, um nach einem Upgrade weiter arbeiten zu können.

Unterschiede anzeigen:

am.pl
48 48
$lxdebug = LXDebug->new();
49 49

  
50 50
use CGI qw( -no_xhtml);
51
use SL::Auth;
51 52
use SL::Form;
52 53
use SL::Locale;
53 54

  
54
eval { require "lx-erp.conf"; };
55
eval { require "lx-erp-local.conf"; } if -f "lx-erp-local.conf";
55
eval { require "config/lx-erp.conf"; };
56
eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf";
57

  
58
our $cgi  = new CGI('');
59
our $form = new Form;
60

  
61
our $auth = SL::Auth->new();
62
if (!$auth->session_tables_present()) {
63
  _show_error('login/auth_db_unreachable');
64
}
65
$auth->expire_sessions();
66
$auth->restore_session();
56 67

  
57 68
require "bin/mozilla/common.pl";
58 69

  
......
61 72
  undef($latex);
62 73
}
63 74

  
64
$form = new Form;
65
$cgi = new CGI('');
66

  
67 75
# this prevents most of the tabindexes being created by CGI.
68 76
# note: most. popup menus and selecttables will still have tabindexes
69 77
# use common.pl's NTI function to get rid of those
......
83 91
# pull in DBI
84 92
use DBI;
85 93

  
94
# locale messages
95
$locale = new Locale($language, "$script");
96

  
97
# did sysadmin lock us out
98
if (-e "$userspath/nologin") {
99
  $form->error($locale->text('System currently down for maintenance!'));
100
}
101

  
86 102
$form->{login} =~ s|.*/||;
87 103

  
88
# check for user config file, could be missing or ???
89
eval { require("$userspath/$form->{login}.conf"); };
90
if ($@) {
91
  $locale = new Locale "$language", "$script";
104
%myconfig = $auth->read_user($form->{login});
92 105

  
93
  $form->{callback} = "";
94
  $msg1             = $locale->text('You are logged out!');
95
  $msg2             = $locale->text('Login');
96
  $form->redirect("$msg1 <p><a href=login.pl target=_top>$msg2</a>");
106
if (!$myconfig{login}) {
107
  _show_error('login/password_error');
97 108
}
98 109

  
99
$myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
100
map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset)
101
  unless (($form->{action} eq 'save') && ($form->{type} eq 'preferences'));
102

  
103 110
# locale messages
104 111
$locale = new Locale "$myconfig{countrycode}", "$script";
105 112

  
106
# check password
107
$form->error($locale->text('Incorrect Password!'))
108
  if ($form->{password} ne $myconfig{password});
109

  
110
# did sysadmin lock us out
111
if (-e "$userspath/nologin") {
112
  $form->error($locale->text('System currently down for maintenance!'));
113
if (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0)) {
114
  _show_error('login/password_error');
113 115
}
114 116

  
117
$auth->set_session_value('login', $form->{login}, 'password', $form->{password});
118
$auth->create_or_refresh_session();
119

  
120
delete $form->{password};
121

  
122
map { $form->{$_} = $myconfig{$_} } qw(stylesheet charset)
123
  unless (($form->{action} eq 'save') && ($form->{type} eq 'preferences'));
124

  
115 125
# pull in the main code
116 126
require "bin/mozilla/$form->{script}";
117 127

  
......
140 150
  $form->error($locale->text('action= not defined!'));
141 151
}
142 152

  
153
sub _show_error {
154
  my $template           = shift;
155
  $locale                = Locale->new($language, 'all');
156
  $myconfig{countrycode} = $language;
157
  $form->{stylesheet}    = 'css/lx-office-erp.css';
158

  
159
  $form->header();
160
  print $form->parse_html_template($template);
161
  exit;
162
}
163

  
143 164
# end
144 165

  

Auch abrufbar als: Unified diff