Split the flows for less code intendation

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-11-17 19:57:14 +01:00
parent bdb40a2d11
commit ab641685ed
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 14 additions and 14 deletions

View File

@ -137,20 +137,20 @@ class RegisterController extends Controller {
] ]
) )
); );
} else {
try {
$this->mailService->sendTokenByMail($registration);
} catch (RegistrationException $e) {
return $this->showEmailForm($email, $e->getMessage());
}
return new RedirectResponse(
$this->urlGenerator->linkToRoute(
'registration.register.showVerificationForm',
['secret' => $registration->getClientSecret()]
)
);
} }
try {
$this->mailService->sendTokenByMail($registration);
} catch (RegistrationException $e) {
return $this->showEmailForm($email, $e->getMessage());
}
return new RedirectResponse(
$this->urlGenerator->linkToRoute(
'registration.register.showVerificationForm',
['secret' => $registration->getClientSecret()]
)
);
} }
/** /**

View File

@ -142,7 +142,7 @@ class RegistrationService {
$registration->setEmail($email); $registration->setEmail($email);
$registration->setUsername($username); $registration->setUsername($username);
$registration->setDisplayname($displayname); $registration->setDisplayname($displayname);
if ($password !== "") { if ($password !== '') {
$password = $this->crypto->encrypt($password); $password = $this->crypto->encrypt($password);
$registration->setPassword($password); $registration->setPassword($password);
} }