Skip to content

Commit

Permalink
Fix default full name in self-registration form
Browse files Browse the repository at this point in the history
When the full name is not specified, the code is supposed to set it to
the username. But that wasn't working because the code was checking
for `null` but the full name is set to an empty string.

Fix this by checking for either an empty string or `null` (casting
`null` to string returns an empty string).
  • Loading branch information
tom93 committed Jul 26, 2024
1 parent 5c96eb0 commit a308a71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webapp/src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function registerAction(
$plainPass = $registration_form->get('plainPassword')->getData();
$password = $passwordHasher->hashPassword($user, $plainPass);
$user->setPassword($password);
if ($user->getName() === null) {
if ((string)$user->getName() === '') {
$user->setName($user->getUsername());
}

Expand Down

0 comments on commit a308a71

Please sign in to comment.