Skip to content

Commit

Permalink
Added Name, Mentor, Mentee fields, and changed where we check the use…
Browse files Browse the repository at this point in the history
…r is logged in
  • Loading branch information
dragonmantank committed Apr 28, 2015
1 parent 807654d commit 928e83c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/Mentoring/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class AccountController
{
public function profileAction(Application $app, Request $request)
{
if ($response = $app['auth.mustAuthenticate']()) {
return $response;
}

$user = $app['session']->get('user');

$form = $this->createProfileForm($app, $user);
Expand Down Expand Up @@ -49,9 +45,16 @@ protected function createProfileForm(Application $app, User $user, array $option
->createBuilder('form', $user, array_merge($options, array(
'data_class' => 'Mentoring\User\User'
)))
->add('name', 'text')
->add('email', 'email', [
'constraints' => [new Email()]
])
->add('isMentor', 'checkbox', [
'required' => false,
])
->add('isMentee', 'checkbox', [
'required' => false,
])
->add('save', 'submit')
->getForm();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mentoring/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function githubAction(Application $app, Request $request)
}

$app['session']->set('user', $user);
return $app->redirect($app['url_generator']->generate('index'));
return $app->redirect($app['url_generator']->generate('account.profile'));
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/Mentoring/ServiceProvider/AccountServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function connect(Application $app)
$controllers
->match('/', 'controller.account:profileAction')
->method('GET|POST')
->bind('account.profile');
->bind('account.profile')
->before($app['auth.mustAuthenticate'])
;

return $controllers;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Mentoring/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public function isEnabled()

public function isMentee()
{
return $this->isMentee;
return (bool)$this->isMentee;
}

public function isMentor()
{
return $this->isMentor;
return (bool)$this->isMentor;
}

public function setEmail($email)
Expand Down

0 comments on commit 928e83c

Please sign in to comment.