Ejemplo n.º 1
0
 public function __construct()
 {
     $this->data['title'] = 'Login - NCube School';
     $this->data['loginAction'] = '/login';
     $this->data['registerAction'] = '/register';
     $this->data['token'] = Token::generate();
     $errors = Session::errors('errors');
     if (gettype($errors) === 'string') {
         $errors = array($errors);
     }
     $this->data['errors'] = $errors;
 }
Ejemplo n.º 2
0
Archivo: login.php Proyecto: ncube/edu
 public function _index()
 {
     $post = Input::post();
     if (empty($post)) {
         header('Location: /');
         exit;
     }
     $validation = Validate::login($post);
     $token = Token::check($post['token']);
     $errors = NULL;
     if ($validation === TRUE && $token === TRUE) {
         if (!User::login($post['username'], $post['password'])) {
             $errors = 'Username or Password is Incorrect';
         }
     } else {
         $errors = $validation;
         if (!$token) {
             $errors = 'Security Token Missing';
         }
     }
     if (!empty($errors)) {
         Session::errors($errors, '/');
     }
 }