Example #1
0
 public function actionProcessEdit(Project $project, Application $app)
 {
     $input = $app['request']->request->all();
     $validation = $app['validator']($input, Project::$rules, Project::$messages);
     if ($validation->passes()) {
         $project->name = $input['name'];
         $project->directory = $input['directory'];
         $project->host = $input['host'];
         $project->remote = $input['remote'];
         $project->repository = $input['repository'];
         $project->branch = $input['branch'];
         $project->hash = $input['hash'];
         switch ($input['trigger']) {
             case 'automatic':
                 $project->triggerAutomatically();
                 break;
             case 'manual':
             default:
                 $project->triggerManually();
                 break;
         }
         $project->save();
         return $app->redirect(array('project.view', array('project' => $project->id)), array('successMessage' => 'Project successfully edited'));
     }
     return $app->forward(array('project.edit', array('project' => $project->id)), array('errorMessages' => $validation->messages()->all(), 'oldInput' => $app['request']->request->all()));
 }
Example #2
0
 public function actionProcessLogin(Application $app)
 {
     $input = $app['request']->request->all();
     try {
         $user = $app['sentry']->authenticate(array('email' => $input['email'], 'password' => $input['password']), true);
     } catch (\Cartalyst\Sentry\Users\LoginRequiredException $e) {
         $errorMessage = 'Email is a required field';
     } catch (\Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         $errorMessage = 'Password is a required field';
     } catch (\Cartalyst\Sentry\Users\WrongPasswordException $e) {
         $errorMessage = 'Login failed';
     } catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) {
         $errorMessage = 'Login failed';
     } catch (\Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         $errorMessage = 'Login failed';
     }
     if (isset($errorMessage)) {
         return $app->forward('login', array('errorMessage' => $errorMessage, 'oldInput' => array('email' => $input['email'])));
     }
     return $app->redirect('home');
 }