Refactor code for session update on password change (#382)
This commit is contained in:
parent
cd9f768ecb
commit
a9d6880917
@ -12,7 +12,7 @@ use base qw(Lemonldap::NG::Portal::_DBI );
|
||||
|
||||
#inherits Lemonldap::NG::Portal::_SMTP
|
||||
|
||||
our $VERSION = '1.1.0';
|
||||
our $VERSION = '1.2.0';
|
||||
|
||||
## @apmethod int passwordDBInit()
|
||||
# Load SMTP functions and call DBI authInit()
|
||||
@ -72,11 +72,6 @@ sub modifyPassword {
|
||||
|
||||
$self->lmLog( "Password changed for $user", 'debug' );
|
||||
|
||||
# Update password in session if needed
|
||||
my $infos;
|
||||
$infos->{_password} = $self->{newpassword};
|
||||
$self->updateSession($infos) if ( $self->{storePassword} );
|
||||
|
||||
PE_PASSWORD_OK;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::UserDBLDAP; #inherits
|
||||
|
||||
#inherits Lemonldap::NG::Portal::_SMTP
|
||||
|
||||
our $VERSION = '1.1.0';
|
||||
our $VERSION = '1.2.0';
|
||||
|
||||
*_formateFilter = *Lemonldap::NG::Portal::UserDBLDAP::formateFilter;
|
||||
*_search = *Lemonldap::NG::Portal::UserDBLDAP::search;
|
||||
@ -57,12 +57,6 @@ sub modifyPassword {
|
||||
$self->{confirmpassword}, $self->{oldpassword}
|
||||
);
|
||||
|
||||
# Update password in session if needed
|
||||
my $infos;
|
||||
$infos->{_password} = $self->{newpassword};
|
||||
$self->updateSession($infos)
|
||||
if ( $self->{storePassword} and $code == PE_PASSWORD_OK );
|
||||
|
||||
return $code unless ( $code == PE_PASSWORD_OK );
|
||||
|
||||
# If password policy and force reset, set reset flag
|
||||
|
@ -1855,12 +1855,20 @@ sub modifyPassword {
|
||||
|
||||
my $res = $self->SUPER::modifyPassword();
|
||||
|
||||
# Continue process if password change is ok
|
||||
if ( $res == PE_PASSWORD_OK ) {
|
||||
|
||||
# Update password in session if needed
|
||||
$self->lmLog( "Update password in session for " . $self->{user},
|
||||
'debug' );
|
||||
|
||||
my $infos;
|
||||
$infos->{_password} = $self->{newpassword};
|
||||
$self->updateSession($infos) if ( $self->{storePassword} );
|
||||
|
||||
# Set a flag to ignore password change in Menu
|
||||
$self->{ignorePasswordChange} = 1;
|
||||
|
||||
# Continue process if password change is ok
|
||||
return PE_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user