修改方法:
打开文件:/includes/modules/integrates/integrate.php
约145– 162行的用户登入函数.如下
1 function login($username, $password, $remember = null) 2 { 3 if ($this->check_user($username, $password) > 0) 4 { 5 if ($this->need_sync) 6 { 7 $this->sync($username,$password); 8 } 9 $this->set_session($username); 10 $this->set_cookie($username, $remember); 11 12 return true; 13 } 14 else 15 { 16 return false; 17 } 18 }
修改为如下:
function login($username, $password, $remember = null) { 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; } 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; } }