optimize declined payment event condition, RT#81305
[freeside.git] / FS / FS / Password_Mixin.pm
index 2e400ec..e2e164b 100644 (file)
@@ -47,7 +47,9 @@ sub is_password_allowed {
   my $self = shift;
   my $password = shift;
 
-  my $cust_main = $self->cust_main;
+  my $cust_main = $self->table eq 'access_user'
+                    ? $self->user_cust_main
+                    : $self->cust_main;
 
   # workaround for non-inserted services
   if ( !$cust_main and $self->get('pkgnum') ) {
@@ -212,8 +214,9 @@ sub insert_password_history {
     }
   
   } else {
-    warn "unrecognized password encoding '$encoding'; treating as plain text"
-      unless $encoding eq 'plain';
+    if ($encoding and $encoding ne 'plain') {
+      warn "unrecognized password encoding '$encoding'; treating as plain text";
+    }
 
     $auth = $self->_blowfishcrypt( $password );