Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e46c6825

Von Sven Schöling vor fast 14 Jahren hinzugefügt

  • ID e46c68251a55936a943e89c4fa6c3be7beff3f05
  • Vorgänger fdcb76f4
  • Nachfolger 4602be1f

Fehler im Bootstrapping besser handhaben.

Konkret, wenn config/authentication.pl nicht richtig geladen wird.

Fix für Bug 1472.

Unterschiede anzeigen:

SL/Auth.pm
59 59
  $self->{dbh}->disconnect() if ($self->{dbh});
60 60
}
61 61

  
62
# form isn't loaded yet, so auth needs it's own error.
63
sub mini_error {
64
  $::lxdebug->show_backtrace();
65

  
66
  my ($self, @msg) = @_;
67
  if ($ENV{HTTP_USER_AGENT}) {
68
    print Form->create_http_response(content_type => 'text/html');
69
    print "<pre>", join ('<br>', @msg), "</pre>";
70
  } else {
71
    print STDERR "Error: @msg\n";
72
  }
73
  ::end_of_request();
74
}
75

  
62 76
sub _read_auth_config {
63 77
  $main::lxdebug->enter_sub();
64 78

  
65 79
  my $self   = shift;
66 80

  
67
  my $form   = $main::form;
68
  my $locale = $main::locale;
69

  
70 81
  my $code;
71 82
  my $in = IO::File->new('config/authentication.pl', 'r');
72 83

  
73 84
  if (!$in) {
74
    $form->error($locale->text('The config file "config/authentication.pl" was not found.'));
85
    my $locale = Locale->new('en');
86
    $self->mini_error($locale->text('The config file "config/authentication.pl" was not found.'));
75 87
  }
76 88

  
77 89
  while (<$in>) {
......
82 94
  eval $code;
83 95

  
84 96
  if ($@) {
85
    $form->error($locale->text('The config file "config/authentication.pl" contained invalid Perl code:') . "\n" . $@);
97
    my $locale = Locale->new('en');
98
    $self->mini_error($locale->text('The config file "config/authentication.pl" contained invalid Perl code:'), $@);
86 99
  }
87 100

  
88 101
  if ($self->{module} eq 'DB') {
......
93 106
  }
94 107

  
95 108
  if (!$self->{authenticator}) {
96
    $form->error($locale->text('No or an unknown authenticantion module specified in "config/authentication.pl".'));
109
    my $locale = Locale->new('en');
110
    $self->mini_error($locale->text('No or an unknown authenticantion module specified in "config/authentication.pl".'));
97 111
  }
98 112

  
99 113
  my $cfg = $self->{DB_config};
100 114

  
101 115
  if (!$cfg) {
102
    $form->error($locale->text('config/authentication.pl: Key "DB_config" is missing.'));
116
    my $locale = Locale->new('en');
117
    $self->mini_error($locale->text('config/authentication.pl: Key "DB_config" is missing.'));
103 118
  }
104 119

  
105 120
  if (!$cfg->{host} || !$cfg->{db} || !$cfg->{user}) {
106
    $form->error($locale->text('config/authentication.pl: Missing parameters in "DB_config". Required parameters are "host", "db" and "user".'));
121
    my $locale = Locale->new('en');
122
    $self->mini_error($locale->text('config/authentication.pl: Missing parameters in "DB_config". Required parameters are "host", "db" and "user".'));
107 123
  }
108 124

  
109 125
  $self->{authenticator}->verify_config();

Auch abrufbar als: Unified diff