Ejemplo n.º 1
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function doExecute()
 {
     $model = new LoginModel();
     $view = $this->getView();
     $view['form'] = $model->getForm();
     return $view->render();
 }
Ejemplo n.º 2
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function execute()
 {
     $model = new LoginModel();
     $user = User::get();
     if ($user->isNull()) {
         $this->setRedirect('login', 'Already logout', 'success');
     }
     $model->logout($user->username);
     $this->setRedirect('login', 'Logout success', 'success');
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function execute()
 {
     $user = User::get();
     if (!$user->isNull()) {
         Ioc::getApplication()->redirect(Router::build('admin:dashboard'));
     }
     $model = new LoginModel();
     $view = new LoginHtmlView();
     $view['form'] = $model->getForm();
     return $view->render();
 }
Ejemplo n.º 4
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function doExecute()
 {
     $model = new LoginModel();
     $router = $this->package->getRouter();
     $user = User::get();
     if ($user->isNull()) {
         $this->setRedirect($router->http('login', array(), Router::TYPE_FULL), 'Already logout', 'success');
     }
     $model->logout($user->username);
     $this->setRedirect($router->http('login', array(), Router::TYPE_FULL), 'Logout success', 'success');
     return true;
 }
Ejemplo n.º 5
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function execute()
 {
     $model = new LoginModel();
     $user = $this->input->getVar('user');
     $result = $model->login($user['username'], $user['password']);
     $package = $this->getPackage();
     if ($result) {
         $url = $package->get('redirect.login');
         $msg = Language::translate('pkg.user.login.success');
     } else {
         $router = Ioc::getRouter();
         $url = $router->build($this->package->getRoutingPrefix() . ':login');
         $msg = Language::translate('pkg.user.login.fail');
     }
     $uri = new Uri($url);
     if (!$uri->getScheme()) {
         $url = $this->app->get('uri.base.full') . $url;
     }
     $this->setRedirect($url, $msg);
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Execute the controller.
  *
  * @return  mixed Return executed result.
  *
  * @throws  \LogicException
  * @throws  \RuntimeException
  */
 public function doExecute()
 {
     $model = new LoginModel();
     $user = $this->input->getVar('user');
     $user = new Data($user);
     $result = $model->login($user['username'], $user['password'], $user['remember']);
     $package = $this->getPackage();
     if ($result) {
         $url = $package->get('redirect.login');
         $msg = Translator::translate('windwalker.user.login.success');
     } else {
         $router = $this->package->getRouter();
         $url = $router->http('login', array(), RestfulRouter::TYPE_FULL);
         $msg = Translator::translate('windwalker.user.login.fail');
     }
     $uri = new Uri($url);
     if (!$uri->getScheme()) {
         $url = $this->app->get('uri.base.full') . $url;
     }
     $this->setRedirect($url, $msg);
     return true;
 }