From af1745af907dd26322e9a9c6db914e2b55f6b58a Mon Sep 17 00:00:00 2001 From: Ole <5199030+oleua@users.noreply.github.com> Date: Sun, 1 Mar 2026 09:24:05 +0200 Subject: [PATCH] Refactor startRegister to use UID instead of displayName Refactoring startRegister function to replace displayName with UID to overcome the error when displayName contains non-ASCII symbols. Solves https://github.com/nextcloud/twofactor_webauthn/issues/945 Signed-off-by: Ole <5199030+oleua@users.noreply.github.com> --- lib/Controller/SettingsController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 6b6123a0..b9863941 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -35,8 +35,15 @@ public function __construct(string $appName, IRequest $request, WebAuthnManager * @UseSession */ public function startRegister(): JSONResponse { - return new JSONResponse($this->manager->startRegistration($this->userSession->getUser(), $this->request->getServerHost())); + $user = $this->userSession->getUser(); + $options = $this->manager->startRegistration($user, $this->request->getServerHost()); + $data = json_decode(json_encode($options), true); + if (isset($data['user']['displayName'])) { + $data['user']['displayName'] = $user->getUID(); + } + return new JSONResponse($data); } + /** * @NoAdminRequired