Skip to content

Commit

Permalink
Lookup login as email when valid address
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Feb 4, 2016
1 parent 815350c commit b77e9ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -551,6 +551,8 @@

/**
* Ensure that email addresses are unique.
*
* @global integer $g_email_ensure_unique
*/
$g_email_ensure_unique = ON;

Expand Down
5 changes: 3 additions & 2 deletions core/authentication_api.php
Expand Up @@ -229,7 +229,7 @@ function auth_auto_create_user( $p_username, $p_password ) {
* such address and it is not blank.
*
* @param string $p_login_name The login name.
* @return user id or false.
* @return integer|boolean user id or false.
*/
function auth_get_user_id_from_login_name( $p_login_name ) {
$t_user_id = user_get_id_by_name( $p_login_name );
Expand All @@ -238,7 +238,8 @@ function auth_get_user_id_from_login_name( $p_login_name ) {
# a single match.
if( $t_user_id === false &&
!is_blank( $p_login_name ) &&
config_get_global( 'email_login_enabled' ) ) {
config_get_global( 'email_login_enabled' ) &&
email_is_valid( $p_login_name ) ) {
$t_user_ids_by_email = user_get_enabled_ids_by_email( $p_login_name );
if ( count( $t_user_ids_by_email ) == 1 ) {
$t_user_id = $t_user_ids_by_email[0];
Expand Down

0 comments on commit b77e9ee

Please sign in to comment.