Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6b352f38

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 6b352f389e016855f98e52efcff612a7f4c7c8e4
  • Vorgänger 4099d0e8
  • Nachfolger 7ba33689

Optionaler Passwortcheck mit cracklib

Conflicts:

locale/de/all

Unterschiede anzeigen:

SL/Auth/PasswordPolicy.pm
4 4

  
5 5
use parent qw(Rose::Object);
6 6

  
7
use constant OK                   =>  0;
8
use constant TOO_SHORT            =>  1;
9
use constant TOO_LONG             =>  2;
10
use constant MISSING_LOWERCASE    =>  4;
11
use constant MISSING_UPPERCASE    =>  8;
12
use constant MISSING_DIGIT        => 16;
13
use constant MISSING_SPECIAL_CHAR => 32;
14
use constant INVALID_CHAR         => 64;
7
use constant OK                   =>   0;
8
use constant TOO_SHORT            =>   1;
9
use constant TOO_LONG             =>   2;
10
use constant MISSING_LOWERCASE    =>   4;
11
use constant MISSING_UPPERCASE    =>   8;
12
use constant MISSING_DIGIT        =>  16;
13
use constant MISSING_SPECIAL_CHAR =>  32;
14
use constant INVALID_CHAR         =>  64;
15
use constant WEAK                 => 128;
15 16

  
16 17
use Rose::Object::MakeMethods::Generic
17 18
(
......
34 35
  $result |= MISSING_SPECIAL_CHAR() if $cfg->{require_special_character} && $password !~ $cfg->{special_characters_re};
35 36
  $result |= INVALID_CHAR()         if $cfg->{invalid_characters_re}     && $password =~ $cfg->{invalid_characters_re};
36 37

  
38
  if ($cfg->{use_cracklib}) {
39
    require Crypt::Cracklib;
40
    $result |= WEAK() if !Crypt::Cracklib::check($password);
41
  }
42

  
37 43
  return $result;
38 44
}
39 45

  
......
47 53
  push @errors, $::locale->text('A lower-case character is required.')                                          if $result & MISSING_LOWERCASE();
48 54
  push @errors, $::locale->text('An upper-case character is required.')                                         if $result & MISSING_UPPERCASE();
49 55
  push @errors, $::locale->text('A digit is required.')                                                         if $result & MISSING_DIGIT();
56
  push @errors, $::locale->text('The password is weak (e.g. it can be found in a dictionary).')                 if $result & WEAK();
50 57

  
51 58
  if ($result & MISSING_SPECIAL_CHAR()) {
52 59
    my $char_list = join ' ', sort split(m//, $self->config->{special_characters});
config/lx_office.conf.default
53 53
# Whether or not to check the policy if the password is set from the
54 54
# user administration.
55 55
disable_policy_for_admin =
56
# Whether or not to check for weak passwords with the "cracklib"
57
# library. Requires the Perl module "Crypt::Cracklib" to be installed.
58
use_cracklib =
56 59

  
57 60
[debug]
58 61
# Use DBIx::Log4perl for logging DBI calls. The string LXDEBUGFILE
locale/de/all
1686 1686
  'The parts have been transferred.' => 'Die Waren wurden umgelagert.',
1687 1687
  'The password is too long (maximum length: #1).' => 'Das Passwort ist zu lang (maximale Länge: #1).',
1688 1688
  'The password is too short (minimum length: #1).' => 'Das Password ist zu kurz (minimale Länge: #1).',
1689
  'The password is weak (e.g. it can be found in a dictionary).' => 'Das Passwort ist schwach (z.B. wenn es in einem Wörterbuch steht).',
1689 1690
  'The payments have been posted.' => 'Die Zahlungen wurden gebucht.',
1690 1691
  'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.',
1691 1692
  'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.',
......
1704 1705
  'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.',
1705 1706
  'The selected warehouse is empty.' => 'Das ausgewählte Lager ist leer.',
1706 1707
  'The session is invalid or has expired.' => 'Sie sind von Lx-Office abgemeldet.',
1707
  'The settings were saved, but the password was not changed.' => 'Die Einstellungen wurden gespeichert, aber das Passwort wurde nicht ge?ndert.',
1708
  'The settings were saved, but the password was not changed.' => 'Die Einstellungen wurden gespeichert, aber das Passwort wurde nicht geändert.',
1708 1709
  'The source warehouse does not contain any bins.' => 'Das Quelllager enthält keine Lagerplätze.',
1709 1710
  'The start date is missing.'  => 'Das Startdatum fehlt.',
1710 1711
  'The subject is missing.'     => 'Der Betreff fehlt.',

Auch abrufbar als: Unified diff