X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEmailAuthentication%2FEmailAuthenticationPlugin.php;h=a17748fe3208d66286ddaa4de44f25fb161966a1;hb=2755e23707d04f9088208dc0aab4451b4482e123;hp=eb2bebac656e2b3b002862f87b65e4216f24a2c5;hpb=f110fc5c9a61ac666d88714b170b12f99d911b11;p=quix0rs-gnu-social.git diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index eb2bebac65..a17748fe32 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -27,27 +27,26 @@ * @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)