fix selfservice password change with ldap encoding, #16810
authorMark Wells <mark@freeside.biz>
Tue, 13 Mar 2012 20:35:22 +0000 (13:35 -0700)
committerMark Wells <mark@freeside.biz>
Tue, 13 Mar 2012 20:35:22 +0000 (13:35 -0700)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/svc_acct.pm

index 7d177f9..acd0c6e 100644 (file)
@@ -2485,7 +2485,7 @@ sub myaccount_passwd {
       unless $svc_acct->check_password($p->{'old_password'});
   }
 
       unless $svc_acct->check_password($p->{'old_password'});
   }
 
-  $svc_acct->_password($p->{'new_password'});
+  $svc_acct->set_password($p->{'new_password'});
   my $error = $svc_acct->replace();
 
   my($label, $value) = $svc_acct->cust_svc->label;
   my $error = $svc_acct->replace();
 
   my($label, $value) = $svc_acct->cust_svc->label;
@@ -2626,7 +2626,7 @@ sub process_reset_passwd {
   my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $svcnum } )
     or return { 'error' => "Service not found" };
 
   my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $svcnum } )
     or return { 'error' => "Service not found" };
 
-  $svc_acct->_password($p->{'new_password'});
+  $svc_acct->set_password($p->{'new_password'});
   my $error = $svc_acct->replace();
 
   my($label, $value) = $svc_acct->cust_svc->label;
   my $error = $svc_acct->replace();
 
   my($label, $value) = $svc_acct->cust_svc->label;
index 139f927..e67db43 100644 (file)
@@ -2524,7 +2524,8 @@ sub check_password {
 
   if ( $self->_password_encoding eq 'ldap' ) {
 
 
   if ( $self->_password_encoding eq 'ldap' ) {
 
-    my $auth = from_rfc2307 Authen::Passphrase $self->_password;
+    $password =~ s/^{PLAIN}/{CLEARTEXT}/;
+    my $auth = from_rfc2307 Authen::Passphrase $password;
     return $auth->match($check_password);
 
   } elsif ( $self->_password_encoding eq 'crypt' ) {
     return $auth->match($check_password);
 
   } elsif ( $self->_password_encoding eq 'crypt' ) {