]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
EmailAuthentication enabled by default
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Apr 2014 10:38:30 +0000 (12:38 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Apr 2014 10:39:57 +0000 (12:39 +0200)
The login field said "Username or email address" already, so...

lib/default.php
plugins/EmailAuthentication/EmailAuthenticationPlugin.php

index 8ac1fa8bbba7e3d8eaba66d8e082c735bc185539..d2270fa6a562532505def19018a896b1c2a0b172 100644 (file)
@@ -301,6 +301,7 @@ $default =
                             'Activity' => array(),
                             'Bookmark' => array(),
                             'ClientSideShorten' => array(),
+                            'EmailAuthentication' => array(),
                             'Event' => array(),
                             'OpenID' => array(),
                             'Poll' => array(),
index eb2bebac656e2b3b002862f87b65e4216f24a2c5..a17748fe3208d66286ddaa4de44f25fb161966a1 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 class EmailAuthenticationPlugin extends Plugin
 {
-    //---interface implementation---//
+    // $nickname for this plugin is the user's email address
     function onStartCheckPassword($nickname, $password, &$authenticatedUser)
     {
-        if(strpos($nickname, '@'))
-        {
-            $user = User::getKV('email',$nickname);
-            if($user && isset($user->email))
-            {
-                if(common_check_user($user->nickname,$password))
-                {
-                    $authenticatedUser = $user;
-                    return false;
-                }
+        if (!strpos($nickname, '@')) {
+            return true;
+        }
+
+        $user = User::getKV('email', $nickname);
+        if ($user instanceof User && $user->email === $nickname) {
+            if (common_check_user($user->nickname, $password)) {
+                $authenticatedUser = $user;
+                return false;
             }
         }
+
+        return true;
     }
 
     function onPluginVersion(&$versions)