X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEmailAuthentication%2FEmailAuthenticationPlugin.php;h=524f1a6411f5732be01086d58fee466c2a93ca50;hb=dd61ae8fbeee64c85f8186672292335592be1ff5;hp=e55614ea432d820faadbec3f26569af9daa51ab6;hpb=12588b1cf73fad7d0a76a29a46ec355150eaa54e;p=quix0rs-gnu-social.git diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index e55614ea43..524f1a6411 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -27,33 +27,32 @@ * @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::staticGet('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) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'Email Authentication', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:EmailAuthentication', 'rawdescription' =>