public function action_logout() { $login_log = new Model_Users_Log_Login(); list($driver, $user_id) = Auth::get_user_id(); $login_log->user_id = $user_id; $login_log->status = 0; $login_log->login_time = strtotime('NOW'); $login_log->attempted_login = ''; $login_log->ip_address = $_SERVER['REMOTE_ADDR']; $login_log->save(); Auth::logout(); Session::set_flash('success', 'You have logged out!'); Response::redirect('/'); }
/** * The basic welcome message * * @access public * @return Response */ public function action_index() { list($driver, $user_id) = Auth::get_user_id(); $this_user = Model_User::find($user_id); $latest_news_q = Model_News::query()->where('call_center_id', $this_user->call_center_id)->or_where('call_center_id', 0)->order_by('created_at', 'DESC'); if ($latest_news_q->count() > 0) { $latest_news = $latest_news_q->get(); } else { $latest_news = null; } $invalid_logins_q = Model_Users_Log_Login::query()->where('user_id', $user_id)->where('status', 2)->order_by('login_time', 'DESC'); if ($invalid_logins_q->count() > 0) { $invalid_logins = $invalid_logins_q->get(); } else { $invalid_logins = null; } $this->template->title = 'Projects » Index'; $this->template->content = View::forge('welcome/index', array('invalid_logins' => $invalid_logins, 'latest_news' => $latest_news))->auto_filter(FALSE); }