From f9059161ecc25ce9453f9904bd531dcba05dbcaa Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 23 Mar 2024 00:01:54 +0100 Subject: [PATCH] Fix oauth name autofill for registration --- src/Controllers/OAuthController.php | 4 ++-- tests/Unit/Controllers/OAuthControllerTest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index d606e4b7..3736cad9 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -309,8 +309,8 @@ class OAuthController extends BaseController $this->session->set('form-data-username', $userdata->get($config['username'])); $this->session->set('form-data-email', $userdata->get($config['email'])); - $this->session->set('form-data-first_name', $userdata->get($config['first_name'])); - $this->session->set('form-data-last_name', $userdata->get($config['last_name'])); + $this->session->set('form-data-firstname', $userdata->get($config['first_name'])); + $this->session->set('form-data-lastname', $userdata->get($config['last_name'])); $this->session->set('oauth2_groups', $userdata->get($config['groups'], [])); $this->session->set('oauth2_connect_provider', $providerName); diff --git a/tests/Unit/Controllers/OAuthControllerTest.php b/tests/Unit/Controllers/OAuthControllerTest.php index fb0e5d2f..70a114b0 100644 --- a/tests/Unit/Controllers/OAuthControllerTest.php +++ b/tests/Unit/Controllers/OAuthControllerTest.php @@ -461,8 +461,8 @@ class OAuthControllerTest extends TestCase $this->assertEquals(null, $this->session->get('oauth2_allow_registration')); $this->assertEquals($this->session->get('form-data-username'), 'username'); $this->assertEquals($this->session->get('form-data-email'), 'foo.bar@localhost'); - $this->assertEquals($this->session->get('form-data-first_name'), 'Foo'); - $this->assertEquals($this->session->get('form-data-last_name'), 'Bar'); + $this->assertEquals($this->session->get('form-data-firstname'), 'Foo'); + $this->assertEquals($this->session->get('form-data-lastname'), 'Bar'); $this->config->set('registration_enabled', false); $this->expectException(HttpNotFound::class); @@ -541,8 +541,8 @@ class OAuthControllerTest extends TestCase $controller->index($request); $this->assertEquals($this->session->get('form-data-username'), 'testuser'); $this->assertEquals($this->session->get('form-data-email'), 'foo.bar@localhost'); - $this->assertEquals($this->session->get('form-data-first_name'), 'Test'); - $this->assertEquals($this->session->get('form-data-last_name'), 'Tester'); + $this->assertEquals($this->session->get('form-data-firstname'), 'Test'); + $this->assertEquals($this->session->get('form-data-lastname'), 'Tester'); }