Authen-Simple-Passwd

 view release on metacpan or  search on metacpan

lib/Authen/Simple/Passwd.pm  view on Meta::CPAN

        return 0;
    }

    while ( defined( $_ = $fh->getline ) ) {

        next if /^#/;
        next if /^\s+/;

        chop;

        my (@credentials) = split( /:/, $_, 3 );

        if ( $credentials[0] eq $username ) {

            $encrypted = $credentials[1];

            $self->log->debug( qq/Found user '$username' in passwd '$path'./ )
              if $self->log;

            last;
        }
    }

    unless ( $fh->close ) {

lib/Authen/Simple/Passwd.pm  view on Meta::CPAN

    unless ( length $encrypted ) {

        $self->log->debug( qq/Encrypted password for user '$username' is null./ )
          if $self->log;

        return 0;
    }

    unless ( $self->check_password( $password, $encrypted ) ) {

        $self->log->debug( qq/Failed to authenticate user '$username'. Reason: 'Invalid credentials'/ )
          if $self->log;

        return 0;
    }

    $self->log->debug( qq/Successfully authenticated user '$username'./ )
      if $self->log;

    return 1;
}



( run in 0.228 second using v1.01-cache-2.11-cpan-a5abf4f5562 )