]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AuthCrypt/AuthCryptPlugin.php
Fix "pending members" group list
[quix0rs-gnu-social.git] / plugins / AuthCrypt / AuthCryptPlugin.php
index 5e9d9835077dbe3c05fb39c2a605795c70387015..540019f9c25955f28aa9d864182e8861dd2998c9 100644 (file)
@@ -44,6 +44,8 @@ class AuthCryptPlugin extends AuthenticationPlugin
 
     function checkPassword($username, $password)
     {
+        $username = Nickname::normalize($username);
+
         $user = User::getKV('nickname', $username);
         if (!($user instanceof User)) {
             return false;
@@ -81,6 +83,8 @@ class AuthCryptPlugin extends AuthenticationPlugin
     // $oldpassword is already verified when calling this function... shouldn't this be private?!
     function changePassword($username, $oldpassword, $newpassword)
     {
+        $username = Nickname::normalize($username);
+
         if (!$this->password_changeable) {
             return false;
         }
@@ -106,17 +110,17 @@ class AuthCryptPlugin extends AuthenticationPlugin
      * EVENTS
      */
 
-    public function onStartChangePassword($user, $oldpassword, $newpassword)
+    public function onStartChangePassword(Profile $target, $oldpassword, $newpassword)
     {
-        if (!$this->checkPassword($user->nickname, $oldpassword)) {
+        if (!$this->checkPassword($target->getNickname(), $oldpassword)) {
             // if we ARE in overwrite mode, test password with common_check_user
-            if (!$this->overwrite || !common_check_user($user->nickname, $oldpassword)) {
+            if (!$this->overwrite || !common_check_user($target->getNickname(), $oldpassword)) {
                 // either we're not in overwrite mode, or the password was incorrect
                 return !$this->authoritative;
             }
             // oldpassword was apparently ok
         }
-        $changed = $this->changePassword($user->nickname, $oldpassword, $newpassword);
+        $changed = $this->changePassword($target->getNickname(), $oldpassword, $newpassword);
 
         return (!$changed && empty($this->authoritative));
     }
@@ -146,7 +150,7 @@ class AuthCryptPlugin extends AuthenticationPlugin
         return true;
     }
 
-    public function onPluginVersion(&$versions)
+    public function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'AuthCrypt',
                             'version' => GNUSOCIAL_VERSION,