public function postLogin(Request $request) { $email = Input::get('email'); $remember = Input::get('remember', 1); $user = User::where('email', $email)->first(); Auth::admin()->login($user, $remember); $user->last_login = date('Y-m-d H:i:s'); $user->save(); //$this->getMenus($user); ActionLog::create(array('user_id' => $user->id, 'content' => config('quickcms.action_log.login'), 'client_ip' => $request->ip())); // return $this->getIndex(); return redirect('/admin/index')->with('user', $user); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $email = Input::get('email'); $password = Input::get('password'); //$password = sha1($password.config('quickcms.admin_pwd_salt')); //$admin = User::where('email',$email)->where('password',$password)->first(); if (Auth::admin()->attempt(['email' => $email, 'password' => $password], true)) { ActionLog::create(array('user_id' => Auth::admin()->get()->id, 'content' => config('quickcms.action_log.login'), 'client_ip' => $request->ip())); // 认证通过... return redirect('/admin/index'); } else { $message = array('result' => false, 'content' => '邮箱或密码错误'); return redirect('/admin/login')->with('message', $message); } // if(is_null($admin)){ // $message = array('result' => false,'content' => '邮箱或密码错误'); // return redirect('/admin/login')->with('message',$message); // } // if($admin->status == 0){ // $message = array('result' => false,'content' => '此用户已被禁用'); // return redirect('/admin/login')->with('message',$message); // } //return $next($request); }