Exemplo n.º 1
0
 public function emptyLogs()
 {
     ActionLog::truncate();
     $message['result'] = 1;
     $message['content'] = $message['result'] ? '清空日志成功' : '清空日志失败';
     return Redirect::to('admin/actionLogs/')->with('message', $message);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 public function getLoginLog()
 {
     $search = Input::get('search')['value'];
     $order = Input::get('order')['0'];
     $length = Input::get('length');
     $select_column = ['action_logs.id', 'users.email', 'action_logs.client_ip', 'action_logs.created_at'];
     $show_column = ['id', 'email', 'client_ip', 'created_at'];
     $order_sql = $show_column[$order['column']] . ' ' . $order['dir'];
     $str_column = self::setTablePrefix(implode(',', $select_column), ['users', 'action_logs']);
     self::setCurrentPage();
     $users = ActionLog::where('content', config('quickcms.action_log.login'))->orderBy('created_at', 'desc')->select('users.email as email', 'action_logs.id', 'action_logs.client_ip', 'action_logs.created_at')->leftJoin('users', 'users.id', '=', 'action_logs.user_id')->whereRaw("concat_ws(" . $str_column . ") like '%" . $search . "%'")->orderByRaw($order_sql)->paginate($length);
     $ret = self::queryPage($show_column, $users);
     return Response::json($ret);
 }