Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for issue #26 #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(
* Register new Diamante User and grant API access for it.
* Sends confirmation email. While registration is not confirmed API access is not active
* @param Command\RegisterCommand $command
* @return void
* @return int DiamanteUser id
*/
public function register(Command\RegisterCommand $command)
{
Expand All @@ -91,6 +91,10 @@ public function register(Command\RegisterCommand $command)
$this->diamanteUserRepository->store($diamanteUser);

$this->registrationMailer->sendConfirmationEmail($diamanteUser->getEmail(), $apiUser->getHash());

$diamanteUser = $this->diamanteUserRepository->findUserByEmail($command->email);

return $diamanteUser->getId();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Diamante/FrontBundle/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function registerAction()
}

try {
$this->get('diamante.front.registration.service')->register($command);
$view = $this->view(['success' => true], Codes::HTTP_CREATED);
$diamanteUSerId = $this->get('diamante.front.registration.service')->register($command);
$view = $this->view(['success' => true, 'diamanteUserId' => $diamanteUSerId], Codes::HTTP_CREATED);
} catch (\Exception $e) {
$this->container->get('monolog.logger.diamante')->error(sprintf('Registration failed for user %s', $command->email));
$view = $this->view(['message' => $e->getMessage()], Codes::HTTP_BAD_REQUEST);
Expand Down