Modify type (#2266)
This commit is contained in:
parent
0a4812203c
commit
7a9020ff25
|
@ -2485,10 +2485,7 @@ m[^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
|
|||
},
|
||||
'passwordPolicy' => {
|
||||
'default' => 1,
|
||||
'test' => sub {
|
||||
return perlExpr(@_);
|
||||
},
|
||||
'type' => 'text'
|
||||
'type' => 'boolOrExpr'
|
||||
},
|
||||
'passwordPolicyMinDigit' => {
|
||||
'default' => 0,
|
||||
|
|
|
@ -1455,8 +1455,7 @@ sub attributes {
|
|||
documentation => 'Hide old password in portal',
|
||||
},
|
||||
passwordPolicy => {
|
||||
type => 'text',
|
||||
test => sub { return perlExpr(@_) },
|
||||
type => 'boolOrExpr',
|
||||
default => 1,
|
||||
documentation => 'Enable password policy',
|
||||
},
|
||||
|
|
|
@ -79,6 +79,7 @@ sub tree {
|
|||
'portalRequireOldPassword',
|
||||
'hideOldPassword',
|
||||
'mailOnPasswordChange',
|
||||
'passwordPolicy',
|
||||
'passwordPolicyMinSize',
|
||||
'passwordPolicyMinLower',
|
||||
'passwordPolicyMinUpper',
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -42,17 +42,26 @@ sub _modifyPassword {
|
|||
return PE_PASSWORD_MISMATCH
|
||||
unless ( $req->data->{newpassword} eq $req->param('confirmpassword') );
|
||||
|
||||
my $rule = $self->p->HANDLER->buildSub(
|
||||
my $oldPwdRule = $self->p->HANDLER->buildSub(
|
||||
$self->p->HANDLER->substitute(
|
||||
$self->conf->{portalRequireOldPassword}
|
||||
)
|
||||
);
|
||||
unless ($rule) {
|
||||
unless ($oldPwdRule) {
|
||||
my $error = $self->p->HANDLER->tsv->{jail}->error || '???';
|
||||
}
|
||||
|
||||
my $pwdPolicyRule = $self->p->HANDLER->buildSub(
|
||||
$self->p->HANDLER->substitute(
|
||||
$self->conf->{passwordPolicy}
|
||||
)
|
||||
);
|
||||
unless ($pwdPolicyRule) {
|
||||
my $error = $self->p->HANDLER->tsv->{jail}->error || '???';
|
||||
}
|
||||
|
||||
# Check if portal require old password
|
||||
if ( $rule->( $req, $req->userData ) or $requireOldPwd ) {
|
||||
if ( $oldPwdRule->( $req, $req->userData ) or $requireOldPwd ) {
|
||||
|
||||
# TODO: verify oldpassword
|
||||
unless ( $req->data->{oldpassword} = $req->param('oldpassword') ) {
|
||||
|
@ -66,7 +75,7 @@ sub _modifyPassword {
|
|||
}
|
||||
|
||||
my $cpq =
|
||||
$self->conf->{passwordPolicy}
|
||||
$pwdPolicyRule->( $req, $req->userData )
|
||||
? $self->checkPasswordQuality( $req->data->{newpassword} )
|
||||
: PE_OK;
|
||||
return $cpq unless ( $cpq == PE_OK );
|
||||
|
|
Loading…
Reference in New Issue
Block a user