Merge pull request #1274 from nlegoff/fix-gh-1271

[3.9] Fix #1271 Can not add user trough validation process
This commit is contained in:
Nicolas Le Goff
2015-03-10 09:50:49 +01:00

View File

@@ -509,17 +509,14 @@ class Push implements ControllerProviderInterface
$user = null;
$email = $request->request->get('email');
try {
$user = $app['repo.users']->findByEmail($email);
if (null !== $user = $app['repo.users']->findByEmail($email)) {
$result['message'] = $app->trans('User already exists');
$result['success'] = true;
$result['user'] = $userFormatter($user);
} catch (\Exception $e) {
return $app->json($result);
}
if (!$user instanceof User) {
try {
$password = $app['random.medium']->generateString(128);
@@ -544,7 +541,6 @@ class Push implements ControllerProviderInterface
} catch (\Exception $e) {
$result['message'] = $app->trans('Error while creating user');
}
}
return $app->json($result);
})->bind('prod_push_do_add_user');