forked from GNUsocial/gnu-social
Merge branch '1.0.x' into testing
This commit is contained in:
commit
f5aba994b2
@ -228,7 +228,7 @@ class LoginAction extends Action
|
|||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
// TRANS: Field label on login page.
|
// TRANS: Field label on login page.
|
||||||
$this->input('nickname', _('Nickname'));
|
$this->input('nickname', _('Username or email'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
// TRANS: Field label on login page.
|
// TRANS: Field label on login page.
|
||||||
|
13
lib/util.php
13
lib/util.php
@ -233,7 +233,13 @@ function common_check_user($nickname, $password)
|
|||||||
$authenticatedUser = false;
|
$authenticatedUser = false;
|
||||||
|
|
||||||
if (Event::handle('StartCheckPassword', array($nickname, $password, &$authenticatedUser))) {
|
if (Event::handle('StartCheckPassword', array($nickname, $password, &$authenticatedUser))) {
|
||||||
$user = User::staticGet('nickname', common_canonical_nickname($nickname));
|
|
||||||
|
if (common_is_email($nickname)) {
|
||||||
|
$user = User::staticGet('email', common_canonical_email($nickname));
|
||||||
|
} else {
|
||||||
|
$user = User::staticGet('nickname', common_canonical_nickname($nickname));
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
if (!empty($password)) { // never allow login with blank password
|
if (!empty($password)) { // never allow login with blank password
|
||||||
if (0 == strcmp(common_munge_password($password, $user->id),
|
if (0 == strcmp(common_munge_password($password, $user->id),
|
||||||
@ -2297,3 +2303,8 @@ function common_log_perf_counters()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function common_is_email($str)
|
||||||
|
{
|
||||||
|
return (strpos($str, '@') !== false);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user