Exemplo n.º 1
0
 public static function handleSignin()
 {
     $params = filter_input_array(INPUT_POST);
     $attributes = array('name' => $params['name'], 'password' => $params['password']);
     $reader = new Reader($attributes);
     $errors = $reader->errors();
     //Let's check that user has entered the same password in both fields
     $oneErr = $reader->passwordFieldsAreSame($params['again']);
     if ($oneErr) {
         $errors[] = $oneErr;
     }
     if (count($errors) == 0) {
         $reader->saveNewReader();
         Redirect::to('/', array('message' => 'Olet luonut käyttäjätunnuksen. Kirjaudu seuraavaksi sisään.'));
     } else {
         View::make('/reader/signin.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }