用email登陸,好處很明顯.
1:可以促使用戶填寫真實的email.
2:不易忘記.
下面的改動,可以使ecshop用email,用戶名都可以完成登陸.
改動版本: ecshop 2.7.0
改動程序: /includes/modules/integrates/integrate.php
改動代碼:145--162行的用戶登陸函數.如下
function login($username, $password)
{
if ($this->check_user($username, $password) > 0)
{
if ($this->need_sync)
{
$this->sync($username,$password);
}
$this->set_session($username);
$this->set_cookie($username);
return true;
}
else
{
return false;
}
}
改為:
function login($username, $password)
{
if(is_email($username))
{
$sql = "select ".$this->field_name." from ".$this->table($this->user_table)." where ".$this->field_email."='".$username."'";
$username = $this->db->getOne($sql);
if(!$username) return false;
//echo $sql;exit;
}
if ($this->check_user($username, $password) > 0)
{
if ($this->need_sync)
{
$this->sync($username,$password);
}
$this->set_session($username);
$this->set_cookie($username);
return true;
}
else
{
return false;
}
}
以上就是關于本文章的內容,希望對大家有所幫助。
新聞熱點
疑難解答