【发布时间】:2015-01-19 00:31:28
【问题描述】:
嘿,所有程序员,我有一个大问题 我的本地主机 xampp 上有一个项目 我的 Auth::attempt 是我本地主机的工作 但是在上传我的网站之前不起作用 我从 app.php 更改我的密钥生成 并从控制器登录测试所有代码 这是我的代码登录电子邮件,密码可从用户模型中填写 我添加了受模型用户保护的主键 我检查我的 Auth.php 是好的
这是我的尝试代码
public function PostLogin()
{
$inputs = Input::all();
$rules = array('email'=>'required|email','pass'=>'required');
$valid = Validator::make($inputs,$rules);
if($valid->fails())
{
return Redirect::to('login')->withErrors($valid);
}else{
$crec = array('email'=>$inputs['email'],'password'=>Input::get('pass'));
if(Auth::attempt($crec))
{
return Redirect::to('/');
}else{
return View::make('users.login')->with('title',Lang::get('users.login'));
}
}
}
/============================================ ====/
protected $fillable = array('email','username','password');
protected $primaryKey = "id";
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
}
======================
请帮忙,谢谢
【问题讨论】:
标签: php authentication laravel