check old_password if passed to self-service API, require with config setting, RT...
authorIvan Kohler <ivan@freeside.biz>
Wed, 7 May 2014 09:05:36 +0000 (02:05 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 7 May 2014 09:05:36 +0000 (02:05 -0700)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/Conf.pm

index 30cddd9..e5078f9 100644 (file)
@@ -2860,6 +2860,13 @@ sub myaccount_passwd {
   my $error = '';
 
   my $conf = new FS::Conf;
+
+  return { 'error' => 'Incorrect current password.' }
+    if  ( exists($p->{'old_password'})
+          || $conf->exists('selfservice-password_change_oldpass')
+        )
+    && ! $svc_acct->check_password($p->{'old_password'});
+
   $error = 'Password too short.'
     if length($p->{'new_password'}) < ($conf->config('passwordmin') || 6);
   $error = 'Password too long.'
index f1893b7..08bd6a7 100644 (file)
@@ -2869,6 +2869,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-password_change_oldpass',
+    'section'     => 'self-service',
+    'description' => 'Require old password to be entered again for password changes (in addition to being logged in), at the API level.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'selfservice-hide_invoices-taxclass',
     'section'     => 'self-service',
     'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',