Esempio n. 1
0
 public function addUser()
 {
     $this->redirectIfLoggedIn();
     $req = $this->app->request;
     $user = new \Models\User();
     list($errors, $fixes) = $user->create($req->post('email'), $req->post('firstname'), $req->post('lastname'), $req->post('password'), $req->post('confirmPassword'));
     if (0 == count($fixes)) {
         $this->app->flashNow('registered', true);
     } else {
         if (!is_null($req->post('email'))) {
             $this->app->flashNow('email', $req->post('email'));
         }
         if (!is_null($req->post('firstname'))) {
             $this->app->flashNow('firstname', $req->post('firstname'));
         }
         if (!is_null($req->post('lastname'))) {
             $this->app->flashNow('lastname', $req->post('lastname'));
         }
         /*
         			echo "ERRORS";
         			print("<pre>");
         			print_r($errors);
         			print_r($fixes);
         			exit;
         */
         $this->app->flashNow('errors', $errors);
         $this->app->flashNow('fixes', $fixes);
     }
     $this->app->flashNow('hideRegister', true);
     $this->app->render('register.twig', array('postLoginUrl' => $this->app->urlFor('home')));
     // Change 'home' to be the page to go to after registering.
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 1) as $index) {
         Models\User::create(['username' => 'admin', 'password' => Hash::make('2515'), 'email' => '*****@*****.**']);
     }
 }