app/controllers/AuthController.php: fixing registerAction()
This commit is contained in:
parent
c75b24d2a9
commit
82fb869042
1 changed files with 15 additions and 7 deletions
|
|
@ -121,16 +121,24 @@ class AuthController extends ControllerBase
|
|||
return;
|
||||
}
|
||||
|
||||
$form = new RegistrationForm($data);
|
||||
$user = new User();
|
||||
$user->assign($data->toArray(), null,
|
||||
[ 'email', 'username', 'firstname', 'lastname' ]);
|
||||
|
||||
$form = new RegistrationForm($user);
|
||||
|
||||
if ($this->request->isPost()) {
|
||||
$user = new User();
|
||||
|
||||
$formData = $this->request->getPost();
|
||||
if ($form->isValid($formData, $user) && $user->save()) {
|
||||
$this->auth->systemLogin($user);
|
||||
$this->flash->success('User successfully created. Now add your first callback!');
|
||||
$this->response->redirect('/callback/new');
|
||||
return;
|
||||
if ($form->isValid($formData)) {
|
||||
$user->setOAuthId($data->getProvider(), $data->getId());
|
||||
if ($user->save()) {
|
||||
$this->auth->systemLogin($user);
|
||||
$this->flash->success('User successfully created. Now add your first callback!');
|
||||
$this->response->redirect('/callback/new');
|
||||
} else {
|
||||
$this->flash->error('Could not create user');
|
||||
}
|
||||
}
|
||||
$form->setEntity($formData);
|
||||
} else {
|
||||
|
|
|
|||
Reference in a new issue