/usr/share/perl5/Lemonldap/NG/Portal/PasswordDBDemo.pm is in liblemonldap-ng-portal-perl 1.9.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ##@file
# Demo password backend file
##@class
# Demo password backend class
package Lemonldap::NG::Portal::PasswordDBDemo;
use strict;
use Lemonldap::NG::Portal::Simple;
our $VERSION = '1.9.1';
## @apmethod int passwordDBInit()
# Check the use of AuthDemo
# @return Lemonldap::NG::Portal constant
sub passwordDBInit {
my $self = shift;
if ( $self->get_module('auth') eq 'Demo' ) {
return PE_OK;
}
else {
$self->lmLog( "Use PasswordDBDemo only with AuthDemo", 'error' );
return PE_ERROR;
}
PE_OK;
}
## @apmethod int modifyPassword()
# Check old password and password mismatch
# @return Lemonldap::NG::Portal constant
sub modifyPassword {
my $self = shift;
# Exit if no password change requested
return PE_OK unless ( $self->{newpassword} );
# Check if portal require old password
if ( $self->{portalRequireOldPassword} ) {
unless ( $self->{oldpassword} ) {
$self->lmLog( "Portal require old password", 'error' );
return PE_PP_MUST_SUPPLY_OLD_PASSWORD;
}
}
# Verify confirmation password matching
return PE_PASSWORD_MISMATCH
unless ( $self->{newpassword} eq $self->{confirmpassword} );
# Check old password
if ( $self->{oldpassword} ) {
# Old password must be the same as uid
return PE_BADOLDPASSWORD
if ( $self->{oldpassword} ne $self->{sessionInfo}->{uid} );
}
# Else accept all passwords
# They will not be changed
PE_OK;
}
1;
|