http://www.ecshop.co/article-1519.html
首先修改注册部分
1,themes/****/user_passport.dwt 会员名称输入的表单,将之去掉
2,js/user.js 找到 function register() 并将以下代码删除
if (username.length == 0)
{
msg += username_empty + '\n';
}
else if (username.match(/^\s*$|^c:\\con\\con$|[%,\'\*\"\s\t\<\>\&\\]/))
{
msg += username_invalid + '\n';
}
else if (username.length < 3)
{
//msg += username_shorter + '\n';
}
3,user.php 找到 elseif ($action == 'act_register') 将以下代码
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
改为
$username = isset($_POST['email']) ? trim($_POST['email']) : '';
其次实现登录时可以使用email登录
1,includes/modules/integrates/integrate.php 找到 function login 并将整个函数改为以下代码
function login($username, $password, $remember = null)
{
if(is_email($username))
{
$sql = "sel ect ".$this->field_name." from ".$this->table($this->user_table)." where ".$this->field_email."='".$username."'";
$username = $this->db->getOne($sql);
if(!$username) return false;
}
if ($this->check_user($username, $password) > 0)
{
if ($this->need_sync)
{
$this->sync($username,$password);
}
$this->set_session($username);
$this->set_cookie($username, $remember);
return true;
}
else
{
return false;
}
}