summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-11-08 14:56:07 -0800
committerIvan Kohler <ivan@freeside.biz>2013-11-08 14:56:07 -0800
commit9c533839580e7914f6e64170ffe7aa76fc945275 (patch)
tree2574b5ab83f25e86d348e9abc89495f77a9334dc
parent311b0ceeab5af6570b5e9980b54848b24c973cad (diff)
fix error return changing password over passwordmax in self-service, RT#24727
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index db50d4250..2aeecc1b2 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -2801,13 +2801,16 @@ sub myaccount_passwd {
} )
or return { 'error' => "Service not found" };
- if ( exists($p->{'old_password'}) ) {
- return { 'error' => "Incorrect password." }
- unless $svc_acct->check_password($p->{'old_password'});
- }
+ my $error = '';
+
+ my $conf = new FS::Conf;
+ $error = 'Password too short.'
+ if length($p->{'new_password'}) < ($conf->config('passwordmin') || 6);
+ $error = 'Password too long.'
+ if length($p->{'new_password'}) > ($conf->config('passwordmax') || 8);
$svc_acct->set_password($p->{'new_password'});
- my $error = $svc_acct->replace();
+ $error ||= $svc_acct->replace();
my($label, $value) = $svc_acct->cust_svc->label;