X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEmailAuthentication%2FEmailAuthenticationPlugin.php;h=524f1a6411f5732be01086d58fee466c2a93ca50;hb=38c84a92c71913fff570b64d21b7d2e07dfa3dd3;hp=4c018537b87f2b14f020ad45fd9ca667ad5e9a7e;hpb=b1a68e15b760aa2e588680c9e8c7526a7a6d1d13;p=quix0rs-gnu-social.git diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index 4c018537b8..524f1a6411 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -27,39 +27,37 @@ * @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' => + // TRANS: Plugin description. _m('The Email Authentication plugin allows users to login using their email address.')); return true; } } -