EmailAuthentication enabled by default

The login field said "Username or email address" already, so...
This commit is contained in:
Mikael Nordfeldth 2014-04-28 12:38:30 +02:00
parent 37ce1f4766
commit 030639d02d
2 changed files with 14 additions and 14 deletions

View File

@ -301,6 +301,7 @@ $default =
'Activity' => array(), 'Activity' => array(),
'Bookmark' => array(), 'Bookmark' => array(),
'ClientSideShorten' => array(), 'ClientSideShorten' => array(),
'EmailAuthentication' => array(),
'Event' => array(), 'Event' => array(),
'OpenID' => array(), 'OpenID' => array(),
'Poll' => array(), 'Poll' => array(),

View File

@ -27,27 +27,26 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
class EmailAuthenticationPlugin extends Plugin class EmailAuthenticationPlugin extends Plugin
{ {
//---interface implementation---// // $nickname for this plugin is the user's email address
function onStartCheckPassword($nickname, $password, &$authenticatedUser) function onStartCheckPassword($nickname, $password, &$authenticatedUser)
{ {
if(strpos($nickname, '@')) if (!strpos($nickname, '@')) {
{ return true;
$user = User::getKV('email',$nickname); }
if($user && isset($user->email))
{ $user = User::getKV('email', $nickname);
if(common_check_user($user->nickname,$password)) if ($user instanceof User && $user->email === $nickname) {
{ if (common_check_user($user->nickname, $password)) {
$authenticatedUser = $user; $authenticatedUser = $user;
return false; return false;
} }
} }
}
return true;
} }
function onPluginVersion(&$versions) function onPluginVersion(&$versions)