diff --git a/include/password-methods/class_password-methods-sasl.inc b/include/password-methods/class_password-methods-sasl.inc
index ab8c6214f3df371cc7bec2b718cc6f4c0b60574f..a170602d1f685894fc8b8015db93a3b2ffdc1490 100644
--- a/include/password-methods/class_password-methods-sasl.inc
+++ b/include/password-methods/class_password-methods-sasl.inc
@@ -1,7 +1,7 @@
 <?php
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
-  Copyright (C) 2011-2016  FusionDirectory
+  Copyright (C) 2011-2017  FusionDirectory
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -27,37 +27,43 @@
  * \brief This class contains all the functions for sasl password methods
  * \see passwordMethod
  */
-class passwordMethodsasl extends passwordMethod {
+class passwordMethodsasl extends passwordMethod
+{
   // uid, or exop specified field value
-  var $uid    = "";
-  var $realm  = "";
-  var $exop   = "";
+  var $uid    = '';
+  var $realm  = '';
+  var $exop   = '';
 
   /*!
    * \brief passwordMethodsasl Constructor
    *
    * \param string $dn The DN
+   * \param object $userTab The user main tab object
    */
-  function __construct($dn = "")
+  function __construct($dn = '', $userTab = NULL)
   {
     global $config;
     $this->realm  = trim($config->get_cfg_value('saslRealm', ''));
     $this->exop   = trim($config->get_cfg_value('saslExop', ''));
 
-    if ($dn == "" || $dn == "new") {
+    if ($dn == '' || $dn == 'new') {
       return;
     }
 
-    $attr = (empty($this->exop)?'uid':$this->exop);
+    $attr = (empty($this->exop) ? 'uid' : $this->exop);
 
-    $ldap = $config->get_ldap_link();
-    $ldap->cd($config->current['BASE']);
-    $ldap->cat($dn, array($attr));
-    if ($ldap->count() == 1) {
-      $attrs = $ldap->fetch();
-      $this->uid = $attrs[$attr][0];
+    if (($userTab !== NULL) && isset($userTab->$attr)) {
+      $this->uid = $userTab->$attr;
     } else {
-      msg_dialog::display(_("Error"), sprintf(_("Cannot change password, unknown user '%s'"), $dn), ERROR_DIALOG);
+      $ldap = $config->get_ldap_link();
+      $ldap->cd($config->current['BASE']);
+      $ldap->cat($dn, array($attr));
+      if ($ldap->count() == 1) {
+        $attrs = $ldap->fetch();
+        $this->uid = $attrs[$attr][0];
+      } else {
+        msg_dialog::display(_('Error'), sprintf(_('Cannot change password, unknown user "%s"'), $dn), ERROR_DIALOG);
+      }
     }
   }
 
diff --git a/include/password-methods/class_password-methods.inc b/include/password-methods/class_password-methods.inc
index 196dbe2b84ab52f59577037cbd1dbaab7343deb9..b8d11ebe8963449642691c52bf059fc00b30016a 100644
--- a/include/password-methods/class_password-methods.inc
+++ b/include/password-methods/class_password-methods.inc
@@ -1,9 +1,8 @@
 <?php
-
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
   Copyright (C) 2003-2010  Cajus Pollmeier
-  Copyright (C) 2011-2016  FusionDirectory
+  Copyright (C) 2011-2017  FusionDirectory
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -32,15 +31,16 @@ class passwordMethod
 {
   var $attrs    = array();
   var $display  = FALSE;
-  var $hash     = "";
+  var $hash     = '';
   var $lockable = TRUE;
 
   /*!
    * \brief Password method contructor
    *
    * \param string $dn The DN
+   * \param object $userTab The user main tab object
    */
-  function __construct($dn = "")
+  function __construct($dn = '', $userTab = NULL)
   {
   }
 
@@ -127,9 +127,9 @@ class passwordMethod
     }
 
     /* Get current password hash */
-    $attrs = $this->attrs;
-    $pwd  = "";
-    $ldap = $config->get_ldap_link();
+    $attrs  = $this->attrs;
+    $pwd    = '';
+    $ldap   = $config->get_ldap_link();
     $ldap->cd($config->current['BASE']);
     if (!empty($dn)) {
       $ldap->cat($dn);
diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc
index fed8e9b673f1dae7a4ccef999228c6434d2c2f01..bf420151d0c31ef8b0915727daa79f56a087c7ec 100644
--- a/plugins/personal/generic/class_user.inc
+++ b/plugins/personal/generic/class_user.inc
@@ -200,7 +200,7 @@ class UserPasswordAttribute extends CompositeAttribute
       trigger_error('Unknown password method '.$values[0]);
       return $values[3];
     }
-    $test = new $temp[$values[0]]($this->plugin->dn);
+    $test = new $temp[$values[0]]($this->plugin->dn, $this->plugin);
     $test->set_hash($values[0]);
     if ($this->plugin->is_template) {
       return $test->generate_hash($values[1]).'|'.$values[1];