X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEmailAuthentication%2FEmailAuthenticationPlugin.php;h=a17748fe3208d66286ddaa4de44f25fb161966a1;hb=2755e23707d04f9088208dc0aab4451b4482e123;hp=406c000731d5e28d15b06bd3f7405cb88d9480fe;hpb=8809e577b2c8cf1b8b187840aaf9674136929ec7;p=quix0rs-gnu-social.git diff --git a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php index 406c000731..a17748fe32 100644 --- a/plugins/EmailAuthentication/EmailAuthenticationPlugin.php +++ b/plugins/EmailAuthentication/EmailAuthenticationPlugin.php @@ -22,44 +22,42 @@ * @category Plugin * @package StatusNet * @author Craig Andrews - * @copyright 2009 Craig Andrews http://candrews.integralblue.com + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @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) { $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; } } -