$this->elementStart('ul', 'form_data');
$this->elementStart('li');
// TRANS: Field label on login page.
- $this->input('nickname', _('Nickname'));
+ $this->input('nickname', _('Username or email'));
$this->elementEnd('li');
$this->elementStart('li');
// TRANS: Field label on login page.
$authenticatedUser = false;
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($password)) { // never allow login with blank password
if (0 == strcmp(common_munge_password($password, $user->id),
}
}
}
+
+function common_is_email($str)
+{
+ return (strpos($str, '@') !== false);
+}