Beispiel #1
0
 public function index()
 {
     if (Acl::isLogin()) {
         return Redirect::action('dashboard');
     }
     return Redirect::action('login');
 }
Beispiel #2
0
 public function init()
 {
     if (!$this->session->get('_h1cms_user', false)) {
         Redirect::action('system/login')->send();
         exit;
     }
     Config::set('view.default', 'default');
 }
Beispiel #3
0
 public function save()
 {
     if (!Security::checkToken(NULL, true)) {
         return Redirect::action('system/setting')->with('error', 'token is invalid');
     }
     $config_items = $this->setting->get('_sys_settingtabs');
     foreach (array_keys($config_items) as $item) {
         $this->setting->save($item, $this->request->request->get($item));
     }
     return Redirect::action('system/setting')->with('success', '系统设置已更新');
 }
Beispiel #4
0
 public function save(Session $session)
 {
     $validator = Validator::make($this->request->request->all());
     $validator->addRule('email', 'required|email', array('required' => '用户名必须填写', 'email' => '必须填写合法的Email'));
     $validator->addRule('password', 'required|len[6,16]', '密码', array('required' => '密码必须填写', 'len' => '密码格式不正确'));
     if (!$validator->validate()) {
         foreach ($validator->errors() as $value) {
             $session->addFlash('error', $value);
         }
         return Redirect::action('system/login');
     }
     $email = $this->request->get('email');
     $password = $this->request->get('password');
     $user = \App\User::findByEmail($email);
     if ($user != NULL && \App\Foundation\Security::checkPassword($password, $user->password)) {
         $session->set('_h1cms_user_id', $user->id);
         $session->set('_h1cms_user_email', $email);
         return Redirect::action('system/dashboard')->with('success', '登录成功');
     } else {
         return Redirect::action('system/login')->with('error', '登录失败');
     }
 }
Beispiel #5
0
 public function edit($id)
 {
     if (!$id) {
         return Redirect::action('system/group')->with('error', '用户组不存在');
     }
     $group = DB::table('usergroups')->where('group_id', $id)->first();
     if (empty($group)) {
         return Redirect::action('system/group')->with('error', '用户组不存在');
     }
     $view = View::make('admin/system/group-edit');
     $view->system_manager = true;
     $view->group = $group;
     $view->token = Security::getToken($id);
     $view->id = $id;
     return $view;
 }
Beispiel #6
0
 /**
  * 退出
  * @return Response
  */
 public function logout()
 {
     Acl::logout();
     return Redirect::action('system/login');
 }