From cc3271e46a216da0496dbb78314d66ab2324f22e Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 26 Jul 2024 15:39:34 +0000 Subject: [PATCH] Fix default full name in self-registration form 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). --- webapp/src/Controller/SecurityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/Controller/SecurityController.php b/webapp/src/Controller/SecurityController.php index e0033e020e..4b74f801a4 100644 --- a/webapp/src/Controller/SecurityController.php +++ b/webapp/src/Controller/SecurityController.php @@ -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()); }