Esempio n. 1
0
 public function actionLogin()
 {
     if (Rays::isLogin()) {
         $this->redirectAction('user', 'home');
     }
     $this->layout = 'user_ui';
     $data = array();
     if (Rays::isPost()) {
         $login = User::login($_POST);
         if ($login instanceof User) {
             Rays::app()->login($login);
             if (!isset($_POST['returnURL'])) {
                 $this->redirect(RHtml::siteUrl("user/home"));
             }
             if (!in_array(Rays::router()->getRouteUrl(RHtml::internalUrl($_POST['returnURL']))['controller'], $this->loginRedirect)) {
                 $this->redirect(RHtml::siteUrl("user/home"));
             }
             $this->redirect($_POST['returnURL']);
         } else {
             $data['loginForm'] = $_POST;
             if (isset($login['verify_error'])) {
                 $this->flash('error', $login['verify_error']);
             }
             $data['validation_errors'] = isset($login['validation_errors']) ? $login['validation_errors'] : null;
         }
     }
     $this->setHeaderTitle("Login");
     $this->addCss('/public/css/form.css');
     $this->render('login', $data, false);
 }