Login using E-email and password. Disallow username and memberID.

On my previous dolphin 6.1.6 install, I added a few lines of code that someone gave me so that only the e-mail address and password may be used to login. The code restricted the username and memberID from being used.

Does anyone know how to do this in 7.0.6?

Quote · 30 May 2011

Hello open the - inc/admin.inc.php

find this function there:

function getID( $str, $with_email = 1 ) {
    if ( $with_email ) {
        if ( eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $str) ) {
            $str = process_db_input($str);
            $mail_arr = db_arr( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$str'" );
            if ( (int)$mail_arr['ID'] ) {
                return (int)$mail_arr['ID'];
            }
        }
    }

    $str = process_db_input($str);
    $iID = (int)db_value( "SELECT `ID` FROM `Profiles` WHERE `NickName` = '$str'" );
   
    if(!$iID) {
        $aProfile = getProfileInfo($str);
        $iID = isset($aProfile['ID']) ? $aProfile['ID'] : 0;
    }
    return $iID;
}

 

and replace with :

function getID($str) {
    $str = process_db_input($str);
    $aItem = db_arr( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$str' OR `ID` = '$str' LIMIT 1" );
    if ( (int)$aItem['ID'] ) {
        return (int)$aItem['ID'];
    }
}

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 30 May 2011

 

Hello open the - inc/admin.inc.php

find this function there:

function getID( $str, $with_email = 1 ) {
    if ( $with_email ) {
        if ( eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $str) ) {
            $str = process_db_input($str);
            $mail_arr = db_arr( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$str'" );
            if ( (int)$mail_arr['ID'] ) {
                return (int)$mail_arr['ID'];
            }
        }
    }

    $str = process_db_input($str);
    $iID = (int)db_value( "SELECT `ID` FROM `Profiles` WHERE `NickName` = '$str'" );
   
    if(!$iID) {
        $aProfile = getProfileInfo($str);
        $iID = isset($aProfile['ID']) ? $aProfile['ID'] : 0;
    }
    return $iID;
}

 

and replace with :

function getID($str) {
    $str = process_db_input($str);
    $aItem = db_arr( "SELECT `ID` FROM `Profiles` WHERE `Email` = '$str' OR `ID` = '$str' LIMIT 1" );
    if ( (int)$aItem['ID'] ) {
        return (int)$aItem['ID'];
    }
}

 That did the trick! thanks.

Quote · 30 May 2011

You're welcome

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 31 May 2011

It appears that this change caused the system to make profiles unviewable. For the past couple of months, when a user clicks a profile to view, it would say that the profile not available for viewing.

 

Alex T logged into my system and came to the conclusion that this was caused by modifying the getID function.

 

I am assuming he is referring to this change since this is the only thing that was done relating to getID.

 

Is there a way to fix my problem while still only allowing email addresses to be used for login?

Quote · 28 Jun 2011

Has this been fixed? I am also looking for a way to make the username/nickname = the email address. I don't want people picking their username/nickname, so I figured the best way was to use email.

Quote · 29 Nov 2011

I found fixes for 7.0.8 to allow email only login and to use email as username. however this caused other issues, like the email being displayed in places I don't want. I'm currently looking at ways around it.

Quote · 30 Nov 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.