Ignore:
Timestamp:
08/25/17 08:21:05 (7 years ago)
Author:
nanardon
Message:

Allow to use a specific cracklib dictionnary

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm

    r2041 r2071  
    561561sub check_password { 
    562562    my ( $self, $password ) = @_; 
    563     my $dictionary; 
     563    my $dictionary = $self->base->config('cracklib_dictionnary') 
    564564 
    565565    if ($password !~ /^[[:ascii:]]*$/) { 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm

    r2047 r2071  
    324324Use a set of syllables instead letter 
    325325 
     326=item checkpassword 
     327 
     328A sub reference to check if generated password is valid 
     329 
    326330=back 
    327331 
     
    330334sub genpassword { 
    331335    my (%options) = @_; 
     336 
     337    $options{checkpassword} ||= sub { 
     338        my ($cpass) = @_; 
     339        return fascist_check($pass) eq 'ok'; 
     340    }; 
     341 
    332342    my @non_alpha = (qw$; : / ! ( ) [ ] { } + = @ - " ' % * & . ? < >$, ',', '$'); 
    333343    my @letters = ('a' .. 'z', 'A' .. 'Z', 0 .. 9); 
     
    366376 
    367377        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)) { 
    369379            return $pass; 
    370380        } 
Note: See TracChangeset for help on using the changeset viewer.