示例#1
0
文件: Index.php 项目: h1soft/h1cms
 public function index()
 {
     if (Acl::isLogin()) {
         return Redirect::action('dashboard');
     }
     return Redirect::action('login');
 }
示例#2
0
 public function init()
 {
     if (!$this->session->get('_h1cms_user', false)) {
         Redirect::action('system/login')->send();
         exit;
     }
     Config::set('view.default', 'default');
 }
示例#3
0
文件: Setting.php 项目: h1soft/h1cms
 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', '系统设置已更新');
 }
示例#4
0
文件: Login.php 项目: h1soft/h1cms
 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', '登录失败');
     }
 }
示例#5
0
文件: Group.php 项目: h1soft/h1cms
 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;
 }
示例#6
0
文件: User.php 项目: h1soft/h1cms
 /**
  * 退出
  * @return Response
  */
 public function logout()
 {
     Acl::logout();
     return Redirect::action('system/login');
 }