Changeset 2071
- Timestamp:
- 08/25/17 08:21:05 (7 years ago)
- Location:
- trunk/LATMOS-Accounts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/Changes
r2062 r2071 1 5.2.19 2 - Allow to use a specific cracklib dictionnary 3 1 4 5.2.16 2 5 - Allow to choose crypt() algorythm using crypt_method setting in -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r2041 r2071 561 561 sub check_password { 562 562 my ( $self, $password ) = @_; 563 my $dictionary ;563 my $dictionary = $self->base->config('cracklib_dictionnary') 564 564 565 565 if ($password !~ /^[[:ascii:]]*$/) { -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm
r2047 r2071 324 324 Use a set of syllables instead letter 325 325 326 =item checkpassword 327 328 A sub reference to check if generated password is valid 329 326 330 =back 327 331 … … 330 334 sub genpassword { 331 335 my (%options) = @_; 336 337 $options{checkpassword} ||= sub { 338 my ($cpass) = @_; 339 return fascist_check($pass) eq 'ok'; 340 }; 341 332 342 my @non_alpha = (qw$; : / ! ( ) [ ] { } + = @ - " ' % * & . ? < >$, ',', '$'); 333 343 my @letters = ('a' .. 'z', 'A' .. 'Z', 0 .. 9); … … 366 376 367 377 my $pass = join('', sort { rand() <=> rand() } @chars); 368 if (length($pass) >= 6 && fascist_check($pass) eq 'ok') {378 if (length($pass) >= 6 && $options{checkpassword}->($pass)) { 369 379 return $pass; 370 380 } -
trunk/LATMOS-Accounts/man/man5/latmos-accounts.ini.pod
r2041 r2071 57 57 58 58 Can be specified per base. 59 60 =head3 cracklib_dictionnary 61 62 The path to a specific dictionnary formated for cracklib library 59 63 60 64 =head2 [_defattr_] SECTION -
trunk/LATMOS-Accounts/t/05_utils.t
r2041 r2071 1 1 use strict; 2 2 use warnings; 3 use Test::More tests => 4 4;3 use Test::More tests => 46; 4 4 use File::Temp qw(mkstemp); 5 5 … … 77 77 is(LATMOS::Accounts::Utils::buildLogin(sub { length($_[0]) > 9 }, 'TotoTataTiti'), 'tototatati', "buildLogin return 8 byte length login"); 78 78 79 ok(LATMOS::Accounts::Utils::genpassword(), "can generate a password"); 80 ok(LATMOS::Accounts::Utils::genpassword( 81 checkpassword => sub { 1 }, 82 ), "can generate a password"); 83 79 84 my $clearpass = 'passwd'; 80 85 my $password = '';
Note: See TracChangeset
for help on using the changeset viewer.