diff --git a/config/config.default.php b/config/config.default.php
index b60d0b07..cd873889 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -233,8 +233,8 @@ return [
// Users are able to sign up
'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true),
- // Required fields on sign-up page
- 'signup_required_fields' => [
+ // Required user fields
+ 'required_user_fields' => [
'pronoun' => (bool) env('PRONOUN_REQUIRED', false),
'firstname' => (bool) env('FIRSTNAME_REQUIRED', false),
'lastname' => (bool) env('LASTNAME_REQUIRED', false),
diff --git a/config/routes.php b/config/routes.php
index 72f52099..a04b53a3 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -8,8 +8,8 @@ use FastRoute\RouteCollector;
// Pages
$route->get('/', 'HomeController@index');
-$route->get('/register', 'SignUpController@view');
-$route->post('/register', 'SignUpController@save');
+$route->get('/register', 'RegistrationController@view');
+$route->post('/register', 'RegistrationController@save');
$route->get('/credits', 'CreditsController@index');
$route->get('/health', 'HealthController@index');
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 30eb0924..093f6e22 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -174,7 +174,7 @@ function Users_view(
unset($user_table_headers[$key]);
}
- $link = button(url('register'), icon('plus-lg'), 'add');
+ $link = button(url('/register'), icon('plus-lg'), 'add');
return page_with_title(__('All users') . ' ' . $link, [
msg(),
table($user_table_headers, $usersList),
@@ -954,7 +954,7 @@ function render_user_tshirt_hint()
$goodie_tshirt = $goodie === GoodieType::Tshirt;
if (
$goodie_tshirt
- && config('signup_required_fields')['tshirt_size']
+ && config('required_user_fields')['tshirt_size']
&& !auth()->user()->personalData->shirt_size
) {
$text = __('You need to specify a tshirt size in your settings!');
diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po
index e270e644..ff0275a6 100644
--- a/resources/lang/de_DE/additional.po
+++ b/resources/lang/de_DE/additional.po
@@ -274,3 +274,9 @@ msgstr "Ort erfolgreich gelöscht."
msgid "validation.name.exists"
msgstr "Der Name wird bereits verwendet."
+
+msgid "registration.disabled"
+msgstr "Die Registrierung ist deaktiviert."
+
+msgid "registration.successful"
+msgstr "Registrierung erfolgreich. Du kannst dich jetzt anmelden!"
diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po
index cbeb37f7..5aff6ded 100644
--- a/resources/lang/de_DE/default.po
+++ b/resources/lang/de_DE/default.po
@@ -1988,23 +1988,17 @@ msgstr "Tag %1$d"
msgid "dashboard.day"
msgstr "Tag"
-msgid "page.sign-up.title"
-msgstr "Engelregistrierung"
+msgid "registration.title"
+msgstr "Engel-Registrierung"
-msgid "page.sign-up.login-data"
+msgid "registration.login_data"
msgstr "Anmeldedaten"
-msgid "page.sign-up.event-data"
+msgid "registration.event_data"
msgstr "Eventdaten"
-msgid "page.sign-up.what-do-you-want-to-do"
+msgid "registration.what_todo"
msgstr "Was möchtest Du machen?"
-msgid "page.sign-up.sign-up"
+msgid "registration.register"
msgstr "Registrieren"
-
-msgid "pages.sign-up.disabled"
-msgstr "Die Engelregistrierung ist deaktiviert"
-
-msgid "pages.sign-up.successful"
-msgstr "Engelregistrierung erfolgreich! Du kannst dich jetzt anmelden!"
diff --git a/resources/lang/en_US/additional.po b/resources/lang/en_US/additional.po
index c0ef8239..9f6f6964 100644
--- a/resources/lang/en_US/additional.po
+++ b/resources/lang/en_US/additional.po
@@ -273,3 +273,9 @@ msgstr "Location successfully deleted."
msgid "validation.name.exists"
msgstr "The name is already used."
+
+msgid "registration.disabled"
+msgstr "The registration is disabled."
+
+msgid "registration.successful"
+msgstr "Registration successful. You can now log in!"
diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po
index 76c08a04..50220dc4 100644
--- a/resources/lang/en_US/default.po
+++ b/resources/lang/en_US/default.po
@@ -576,23 +576,17 @@ msgstr "Day %1$d"
msgid "dashboard.day"
msgstr "Day"
-msgid "page.sign-up.title"
+msgid "registration.title"
msgstr "Angel registration"
-msgid "page.sign-up.login-data"
+msgid "registration.login_data"
msgstr "Login data"
-msgid "page.sign-up.event-data"
+msgid "registration.event_data"
msgstr "Event data"
-msgid "page.sign-up.what-do-you-want-to-do"
+msgid "registration.what_todo"
msgstr "What do you want to do?"
-msgid "page.sign-up.sign-up"
+msgid "registration.register"
msgstr "Register"
-
-msgid "pages.sign-up.disabled"
-msgstr "The angel registration is disabled"
-
-msgid "pages.sign-up.successful"
-msgstr "Angel registration success. You can now log in."
diff --git a/resources/views/pages/sign-up.twig b/resources/views/pages/registration.twig
similarity index 97%
rename from resources/views/pages/sign-up.twig
rename to resources/views/pages/registration.twig
index 1d9b1b8f..44a66844 100644
--- a/resources/views/pages/sign-up.twig
+++ b/resources/views/pages/registration.twig
@@ -2,7 +2,7 @@
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
-{% block title %}{{ __('page.sign-up.title') }}{% endblock %}
+{% block title %}{{ __('registration.title') }}{% endblock %}
{% block content %}
@@ -12,7 +12,7 @@
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm')
: ''
}}
- {{ __('page.sign-up.title') }}
+ {{ __('registration.title') }}
@@ -22,7 +22,7 @@
{{ csrf() }}
-
{{ __('page.sign-up.login-data') }}
+
{{ __('registration.login_data') }}
{% if isPronounEnabled %}
@@ -188,7 +188,7 @@
{% endif %}
-
{{ __('page.sign-up.event-data') }}
+
{{ __('registration.event_data') }}
{% if isGoodieEnabled %}
@@ -284,7 +284,7 @@
-
{{ __('page.sign-up.what-do-you-want-to-do') }}
+
{{ __('registration.what_todo') }}
{% for angelType in angelTypes %}
@@ -318,7 +318,7 @@
By assigning a name here, some magic™ will create a session var
"form-data-register-submit" with the value 1 on submit.
#}
- {{ f.submit(__('page.sign-up.sign-up'), {
+ {{ f.submit(__('registration.register'), {
'name': 'register-submit',
}) }}
diff --git a/src/Controllers/SignUpController.php b/src/Controllers/RegistrationController.php
similarity index 95%
rename from src/Controllers/SignUpController.php
rename to src/Controllers/RegistrationController.php
index 85c62d0d..44f1a81c 100644
--- a/src/Controllers/SignUpController.php
+++ b/src/Controllers/RegistrationController.php
@@ -15,7 +15,7 @@ use Engelsystem\Http\Response;
use Engelsystem\Models\AngelType;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
-class SignUpController extends BaseController
+class RegistrationController extends BaseController
{
use HasUserNotifications;
@@ -48,7 +48,7 @@ class SignUpController extends BaseController
$rawData = $request->getParsedBody();
$user = $this->userFactory->createFromData($rawData);
- $this->addNotification('pages.sign-up.successful');
+ $this->addNotification('registration.successful');
if ($this->config->get('welcome_msg')) {
// Set a session marker to display the welcome message on the next page
@@ -71,7 +71,7 @@ class SignUpController extends BaseController
private function notifySignUpDisabledAndRedirectToHome(): Response
{
- $this->addNotification('pages.sign-up.disabled', NotificationType::INFORMATION);
+ $this->addNotification('registration.disabled', NotificationType::INFORMATION);
return $this->redirect->to('/');
}
@@ -79,7 +79,7 @@ class SignUpController extends BaseController
{
$goodieType = GoodieType::from($this->config->get('goodie_type'));
$preselectedAngelTypes = $this->determinePreselectedAngelTypes();
- $requiredFields = $this->config->get('signup_required_fields');
+ $requiredFields = $this->config->get('required_user_fields');
// form-data-register-submit is a marker, that the form was submitted.
// It will be used for instance to use the default angel types or the user selected ones.
@@ -87,7 +87,7 @@ class SignUpController extends BaseController
$this->session->remove('form-data-register-submit');
return $this->response->withView(
- 'pages/sign-up',
+ 'pages/registration',
[
'tShirtSizes' => $this->config->get('tshirt_sizes'),
'angelTypes' => AngelType::whereHideRegister(false)->get(),
diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php
index d64a3aee..8c0068af 100644
--- a/src/Controllers/SettingsController.php
+++ b/src/Controllers/SettingsController.php
@@ -35,7 +35,7 @@ class SettingsController extends BaseController
public function profile(): Response
{
$user = $this->auth->user();
- $requiredFields = $this->config->get('signup_required_fields');
+ $requiredFields = $this->config->get('required_user_fields');
return $this->response->withView(
'pages/settings/profile',
@@ -368,7 +368,7 @@ class SettingsController extends BaseController
private function isRequired(string $key): string
{
- $requiredFields = $this->config->get('signup_required_fields');
+ $requiredFields = $this->config->get('required_user_fields');
return $requiredFields[$key] ? 'required' : 'optional';
}
diff --git a/src/Factories/User.php b/src/Factories/User.php
index 4fbd4e66..030c767f 100644
--- a/src/Factories/User.php
+++ b/src/Factories/User.php
@@ -40,7 +40,7 @@ class User
* Takes some arbitrary data, validates it and tries to create a user from it.
*
* @param Array
$rawData Raw data from which a user should be created
- * @return The user if successful
+ * @return EngelsystemUser The user if successful
* @throws
*/
public function createFromData(array $rawData): EngelsystemUser
@@ -69,7 +69,7 @@ class User
private function isRequired(string $key): string
{
- $requiredFields = $this->config->get('signup_required_fields');
+ $requiredFields = $this->config->get('required_user_fields');
return $requiredFields[$key] ? 'required' : 'optional';
}
diff --git a/tests/Feature/Controllers/SignUpControllerTest.php b/tests/Feature/Controllers/RegistrationControllerTest.php
similarity index 92%
rename from tests/Feature/Controllers/SignUpControllerTest.php
rename to tests/Feature/Controllers/RegistrationControllerTest.php
index d30754af..5a47067e 100644
--- a/tests/Feature/Controllers/SignUpControllerTest.php
+++ b/tests/Feature/Controllers/RegistrationControllerTest.php
@@ -6,7 +6,7 @@ namespace Engelsystem\Test\Feature\Controllers;
use Engelsystem\Application;
use Engelsystem\Config\Config;
-use Engelsystem\Controllers\SignUpController;
+use Engelsystem\Controllers\RegistrationController;
use Engelsystem\Events\Listener\OAuth2;
use Engelsystem\Models\AngelType;
use Engelsystem\Models\BaseModel;
@@ -17,9 +17,9 @@ use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
- * @group sign-up-controller-tests
+ * @group registration-controller-tests
*/
-final class SignUpControllerTest extends ApplicationFeatureTest
+final class RegistrationControllerTest extends ApplicationFeatureTest
{
private Application $application;
private Config $config;
@@ -32,7 +32,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
* @var Array
*/
private array $modelsToBeDeleted;
- private SignUpController $subject;
+ private RegistrationController $subject;
public function setUp(): void
{
@@ -45,7 +45,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
$this->application->instance(OAuth2::class, $this->oauth);
$this->config = $this->application->get(Config::class);
$this->session = $this->application->get(SessionInterface::class);
- $this->subject = $this->application->make(SignUpController::class);
+ $this->subject = $this->application->make(RegistrationController::class);
}
public function tearDown(): void
@@ -55,10 +55,10 @@ final class SignUpControllerTest extends ApplicationFeatureTest
}
/**
- * Renders the sign-up page with a minimum fields config.
+ * Renders the registration page with a minimum fields config.
* Asserts that the basic fields are there while the other fields are not there.
*
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewMinimumConfig(): void
{
@@ -87,10 +87,10 @@ final class SignUpControllerTest extends ApplicationFeatureTest
}
/**
- * Renders the sign-up page with a maximum fields config.
+ * Renders the registration page with a maximum fields config.
* Asserts that all fields are there.
*
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewMaximumConfig(): void
{
@@ -117,7 +117,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewAngelTypesOAuthPreselection(): void
{
@@ -154,7 +154,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewAngelTypesPreselection(): void
{
@@ -180,7 +180,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
/**
* Asserts that values are prefilled after submit
*
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewValuesAfterSubmit(): void
{
@@ -207,7 +207,7 @@ final class SignUpControllerTest extends ApplicationFeatureTest
* Creates three angel types:
* - unrestricted
* - restricted
- * - unrestricted, hidden on sign-up
+ * - unrestricted, hidden on registration
*
* @return Array
*/
diff --git a/tests/Unit/Controllers/SignUpControllerTest.php b/tests/Unit/Controllers/RegistrationControllerTest.php
similarity index 86%
rename from tests/Unit/Controllers/SignUpControllerTest.php
rename to tests/Unit/Controllers/RegistrationControllerTest.php
index bf3ffafd..85e88c25 100644
--- a/tests/Unit/Controllers/SignUpControllerTest.php
+++ b/tests/Unit/Controllers/RegistrationControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Engelsystem\Test\Unit\Controllers;
-use Engelsystem\Controllers\SignUpController;
+use Engelsystem\Controllers\RegistrationController;
use Engelsystem\Factories\User;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Models\OAuth;
@@ -12,9 +12,9 @@ use Engelsystem\Models\User\User as EngelsystemUser;
use PHPUnit\Framework\MockObject\MockObject;
/**
- * @group sign-up-controller-tests
+ * @group registration-controller-tests
*/
-final class SignUpControllerTest extends ControllerTest
+final class RegistrationControllerTest extends ControllerTest
{
/**
* @var Authenticator&MockObject
@@ -26,7 +26,7 @@ final class SignUpControllerTest extends ControllerTest
*/
private User $userFactory;
- private SignUpController $subject;
+ private RegistrationController $subject;
public function setUp(): void
{
@@ -44,11 +44,11 @@ final class SignUpControllerTest extends ControllerTest
->getMock();
$this->config->set('oauth', []);
$this->app->instance(User::class, $this->userFactory);
- $this->subject = $this->app->make(SignUpController::class);
+ $this->subject = $this->app->make(RegistrationController::class);
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testSave(): void
{
@@ -75,7 +75,7 @@ final class SignUpControllerTest extends ControllerTest
// Assert that the success notification is there
self::assertEquals(
[
- 'messages.message' => ['pages.sign-up.successful'],
+ 'messages.message' => ['registration.successful'],
],
$this->session->all()
);
@@ -86,7 +86,7 @@ final class SignUpControllerTest extends ControllerTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testSaveAlreadyLoggedIn(): void
{
@@ -96,7 +96,7 @@ final class SignUpControllerTest extends ControllerTest
// Fake logged in user
$this->authenticator->method('user')->willReturn(new EngelsystemUser());
- // Assert that the user is redirected to /sign-up again
+ // Assert that the user is redirected to /register again
$this->response
->expects(self::once())
->method('redirectTo')
@@ -106,7 +106,7 @@ final class SignUpControllerTest extends ControllerTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testSaveOAuth(): void
{
@@ -136,7 +136,7 @@ final class SignUpControllerTest extends ControllerTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testSaveWithWelcomeMesssage(): void
{
@@ -153,7 +153,7 @@ final class SignUpControllerTest extends ControllerTest
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testSaveRegistrationDisabled(): void
{
@@ -176,14 +176,14 @@ final class SignUpControllerTest extends ControllerTest
// Assert that the error notification is there
self::assertEquals(
[
- 'messages.information' => ['pages.sign-up.disabled'],
+ 'messages.information' => ['registration.disabled'],
],
$this->session->all()
);
}
/**
- * @covers \Engelsystem\Controllers\SignUpController
+ * @covers \Engelsystem\Controllers\RegistrationController
*/
public function testViewRegistrationDisabled(): void
{
@@ -206,7 +206,7 @@ final class SignUpControllerTest extends ControllerTest
// Assert that the error notification is there
self::assertEquals(
[
- 'messages.information' => ['pages.sign-up.disabled'],
+ 'messages.information' => ['registration.disabled'],
],
$this->session->all()
);
diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php
index 89354e38..b5bd4ec0 100644
--- a/tests/Unit/Controllers/SettingsControllerTest.php
+++ b/tests/Unit/Controllers/SettingsControllerTest.php
@@ -949,7 +949,7 @@ class SettingsControllerTest extends ControllerTest
'locales' => $languages,
'tshirt_sizes' => $tshirt_sizes,
'goodie_type' => GoodieType::Goodie->value,
- 'signup_required_fields' => $requiredFields,
+ 'required_user_fields' => $requiredFields,
]);
$this->app->instance('config', $this->config);
$this->app->instance(Config::class, $this->config);
diff --git a/tests/Unit/Factories/UserTest.php b/tests/Unit/Factories/UserTest.php
index 38599aef..621b834a 100644
--- a/tests/Unit/Factories/UserTest.php
+++ b/tests/Unit/Factories/UserTest.php
@@ -337,7 +337,7 @@ class UserTest extends ServiceProviderTest
$user->userAngelTypes->contains('name', $angelTypes[0]->name)
);
- // Do not expect an assignment of the angel type hidden on sign-up
+ // Do not expect an assignment of the angel type hidden on registration
$this->assertFalse(
$user->userAngelTypes->contains('name', $angelTypes[1]->name)
);
@@ -461,7 +461,7 @@ class UserTest extends ServiceProviderTest
/**
* Creates two AngelTypes:
* 1. Normal angel type
- * 2. Angel type hidden on sign-up
+ * 2. Angel type hidden on registration
*
* @return Array
*/
diff --git a/tests/Utils/SignUpConfig.php b/tests/Utils/SignUpConfig.php
index 5f97c7cf..55900be8 100644
--- a/tests/Utils/SignUpConfig.php
+++ b/tests/Utils/SignUpConfig.php
@@ -35,7 +35,7 @@ final class SignUpConfig
$config->set('enable_user_name', true);
$config->set('enable_mobile_show', true);
$config->set('enable_dect', true);
- $config->set('signup_required_fields', $requiredFields);
+ $config->set('required_user_fields', $requiredFields);
}
public static function setMinimumConfig(Config $config): void
@@ -48,12 +48,6 @@ final class SignUpConfig
'mobile' => false,
'dect' => false,
];
- $requiredFields['pronoun'] = false;
- $requiredFields['firstname'] = false;
- $requiredFields['lastname'] = false;
- $requiredFields['tshirt_size'] = true;
- $requiredFields['mobile'] = false;
- $requiredFields['dect'] = false;
$config->set('registration_enabled', true);
$config->set('enable_password', true);
$config->set('enable_pronoun', false);
@@ -66,6 +60,6 @@ final class SignUpConfig
$config->set('enable_user_name', false);
$config->set('enable_mobile_show', false);
$config->set('enable_dect', false);
- $config->set('signup_required_fields', $requiredFields);
+ $config->set('required_user_fields', $requiredFields);
}
}