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;
|
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()) {
|
if ($this->request->isPost()) {
|
||||||
$user = new User();
|
|
||||||
$formData = $this->request->getPost();
|
$formData = $this->request->getPost();
|
||||||
if ($form->isValid($formData, $user) && $user->save()) {
|
if ($form->isValid($formData)) {
|
||||||
$this->auth->systemLogin($user);
|
$user->setOAuthId($data->getProvider(), $data->getId());
|
||||||
$this->flash->success('User successfully created. Now add your first callback!');
|
if ($user->save()) {
|
||||||
$this->response->redirect('/callback/new');
|
$this->auth->systemLogin($user);
|
||||||
return;
|
$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);
|
$form->setEntity($formData);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Reference in a new issue