From 7c8070031fdd4f42e3c22eb510349b1c1229a5d5 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:29:08 -0400 Subject: [PATCH 1/9] restyle login/register social and action buttons --- assets/styles/components/_login.scss | 24 +++++++++++++------ assets/styles/layout/_forms.scss | 6 +++++ templates/components/login_socials.html.twig | 13 +++++----- .../components/user_form_actions.html.twig | 11 +++++---- .../resend.html.twig | 4 ++-- templates/reset_password/request.html.twig | 3 +-- templates/reset_password/reset.html.twig | 3 +-- templates/user/login.html.twig | 6 +++-- templates/user/register.html.twig | 4 ++-- 9 files changed, 46 insertions(+), 28 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index 7fe9c5a7d..2e8655803 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -15,21 +15,31 @@ font-weight: bold; } + .separator:has(+ div a), .separator:has(+ p) { + border: var(--kbin-section-border); + height: 0; + margin: 15px 30px; + } + .actions { - margin-top: 3rem; + margin-top: 1rem; display: block; } .social { - display: flex; - gap: 2rem; + grid-template-columns: repeat(1, 1fr); + @include media-breakpoint-up(lg) { + &:has(a + a) { + grid-template-columns: repeat(2, 1fr); + } + } + + display: grid; + gap: 0.5rem; justify-content: center; - margin-top: 3rem; a { - align-items: center; - display: inline-flex; - gap: .5rem; + text-align: center; } } } diff --git a/assets/styles/layout/_forms.scss b/assets/styles/layout/_forms.scss index 438442b71..c4e8ed74e 100644 --- a/assets/styles/layout/_forms.scss +++ b/assets/styles/layout/_forms.scss @@ -434,6 +434,12 @@ select { } } +.button-flex { + button { + width: 100%; + } +} + .actions { @include media-breakpoint-down(sm) { text-align: right; diff --git a/templates/components/login_socials.html.twig b/templates/components/login_socials.html.twig index 8e744c518..7257e069a 100644 --- a/templates/components/login_socials.html.twig +++ b/templates/components/login_socials.html.twig @@ -1,27 +1,28 @@ {# @var this App\Twig\Components\LoginSocialsComponent #} +
{% if this.googleEnabled %} - Google + Google {% endif %} {% if this.facebookEnabled %} - Facebook + Facebook {% endif %} {% if this.githubEnabled %} - GitHub + GitHub {% endif %} {% if this.keycloakEnabled %} - Keycloak + Keycloak {% endif %} {% if this.zitadelEnabled %} - Zitadel + Zitadel {% endif %} {% if this.azureEnabled %} - Microsoft + Microsoft {% endif %}
diff --git a/templates/components/user_form_actions.html.twig b/templates/components/user_form_actions.html.twig index e7a923d20..0a5b30b32 100644 --- a/templates/components/user_form_actions.html.twig +++ b/templates/components/user_form_actions.html.twig @@ -1,18 +1,19 @@
+
{% if showLogin %} -

{{ 'already_have_account'|trans }} +

{{ 'already_have_account'|trans }} {{ 'login'|trans }}

{% endif %} {% if kbin_registrations_enabled() %} {% if showRegister %} -

{{ 'dont_have_account'|trans }} +

{{ 'dont_have_account'|trans }} {{ 'register'|trans }}

- {% endif %} + {% endif %} {% endif %} {% if showPasswordReset %} -

{{ 'you_cant_login'|trans }} +

{{ 'you_cant_login'|trans }} {{ 'reset_password'|trans }}

{% endif %} @@ -21,4 +22,4 @@ {# {{ 'resend_account_activation_email'|trans }}#} {#

#} {# {% endif %}#} -
\ No newline at end of file + diff --git a/templates/resend_verification_email/resend.html.twig b/templates/resend_verification_email/resend.html.twig index fb488f3a8..634fa8a28 100644 --- a/templates/resend_verification_email/resend.html.twig +++ b/templates/resend_verification_email/resend.html.twig @@ -16,9 +16,9 @@

{{ 'resend_account_activation_email'|trans }}

-

{{ 'resend_account_activation_email_description'|trans }}

+

{{ 'resend_account_activation_email_description'|trans }}

- {{ form_start(form) }} + {{ form_start(form) }} {% for flash_error in app.flashes('error') %}
{{ flash_error|trans }}
{% endfor %} diff --git a/templates/reset_password/request.html.twig b/templates/reset_password/request.html.twig index e0796068f..daba63a2f 100644 --- a/templates/reset_password/request.html.twig +++ b/templates/reset_password/request.html.twig @@ -24,12 +24,11 @@ label: 'email' }) }} -
+
{{ form_end(form) }} {{ component('user_form_actions', {showLogin: true, showRegister: true, showResendEmail: true}) }} - {{ component('login_socials') }}
{% endblock %} diff --git a/templates/reset_password/reset.html.twig b/templates/reset_password/reset.html.twig index 670b44be4..2b3504479 100644 --- a/templates/reset_password/reset.html.twig +++ b/templates/reset_password/reset.html.twig @@ -22,12 +22,11 @@ {% endfor %} {{ form_row(form.plainPassword) }} -
+
{{ form_end(form) }} {{ component('user_form_actions', {showLogin: true, showRegister: true , showResendEmail: true}) }} - {{ component('login_socials') }}
{% endblock %} diff --git a/templates/user/login.html.twig b/templates/user/login.html.twig index 97304080b..8d01353b8 100644 --- a/templates/user/login.html.twig +++ b/templates/user/login.html.twig @@ -42,13 +42,15 @@ -
+
- {{ component('user_form_actions', {showRegister: true, showPasswordReset: true, showResendEmail: true}) }} {% endif %} {{ component('login_socials') }} + {% if not_sso_only_mode %} + {{ component('user_form_actions', {showRegister: true, showPasswordReset: true, showResendEmail: true}) }} + {% endif %}
{% endblock %} diff --git a/templates/user/register.html.twig b/templates/user/register.html.twig index 3b720d441..294ef637f 100644 --- a/templates/user/register.html.twig +++ b/templates/user/register.html.twig @@ -54,17 +54,17 @@ class: 'btn btn__primary' }, row_attr: { - class: 'float-end' + class: 'button-flex' } }) }} {{ form_end(form) }} {% else %}

{{ 'registration_disabled'|trans }}

{% endif %} - {{ component('user_form_actions', {showLogin: true, showPasswordReset: true, showResendEmail: true}) }} {% if mbin_sso_registrations_enabled() %} {{ component('login_socials') }} {% endif %} + {{ component('user_form_actions', {showLogin: true, showPasswordReset: true, showResendEmail: true}) }} {% endblock %} From b5eda6a5bd6e824a133440fabf9a7c92435d6786 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:33:12 -0400 Subject: [PATCH 2/9] move separator up out of action div --- assets/styles/components/_login.scss | 2 +- templates/components/user_form_actions.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index 2e8655803..f49936b65 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -15,7 +15,7 @@ font-weight: bold; } - .separator:has(+ div a), .separator:has(+ p) { + .separator:has(+ div a), .separator:has(+ div p) { border: var(--kbin-section-border); height: 0; margin: 15px 30px; diff --git a/templates/components/user_form_actions.html.twig b/templates/components/user_form_actions.html.twig index 0a5b30b32..de8ab4cc1 100644 --- a/templates/components/user_form_actions.html.twig +++ b/templates/components/user_form_actions.html.twig @@ -1,5 +1,5 @@ +
-
{% if showLogin %}

{{ 'already_have_account'|trans }} {{ 'login'|trans }} From d6a384ef6822da53b01b08ec7300f75cda282cd6 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:15:14 -0400 Subject: [PATCH 3/9] exclude separator when sso only mode --- assets/styles/components/_login.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index f49936b65..1f95da92c 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -15,7 +15,7 @@ font-weight: bold; } - .separator:has(+ div a), .separator:has(+ div p) { + form ~ .separator:has(+ div a), .separator:has(+ div p) { border: var(--kbin-section-border); height: 0; margin: 15px 30px; From cd1fd54ca74f676be1918aa8c57c4837ea08f403 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 20 Apr 2024 15:21:34 -0400 Subject: [PATCH 4/9] admin option for socials first add continue with to buttons reduce button size a bit --- assets/styles/components/_login.scss | 7 ++++++- assets/styles/layout/_forms.scss | 7 ++++++- src/DTO/SettingsDto.php | 5 ++++- src/Form/SettingsType.php | 1 + src/Service/SettingsManager.php | 3 ++- src/Twig/Extension/SettingsExtension.php | 1 + src/Twig/Runtime/SettingsExtensionRuntime.php | 5 +++++ templates/admin/settings.html.twig | 4 ++++ templates/components/login_socials.html.twig | 13 +++++++------ templates/user/login.html.twig | 7 ++++++- templates/user/register.html.twig | 5 ++++- translations/messages.en.yaml | 2 ++ 12 files changed, 48 insertions(+), 12 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index 1f95da92c..0401a1add 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -15,7 +15,12 @@ font-weight: bold; } - form ~ .separator:has(+ div a), .separator:has(+ div p) { + .separator { + display: none; + height: 0; + } + form ~ .separator:has(+ div a), .separator:has(+ div a), .separator:has(+ div p) { + display: block; border: var(--kbin-section-border); height: 0; margin: 15px 30px; diff --git a/assets/styles/layout/_forms.scss b/assets/styles/layout/_forms.scss index c4e8ed74e..edc4f2eb9 100644 --- a/assets/styles/layout/_forms.scss +++ b/assets/styles/layout/_forms.scss @@ -435,8 +435,13 @@ select { } .button-flex { + text-align: center; button { - width: 100%; + width: 50%; + + @include media-breakpoint-down(lg) { + width: 100%; + } } } diff --git a/src/DTO/SettingsDto.php b/src/DTO/SettingsDto.php index 81435e4c7..2ce5fd2d2 100644 --- a/src/DTO/SettingsDto.php +++ b/src/DTO/SettingsDto.php @@ -32,7 +32,8 @@ public function __construct( public bool $KBIN_FEDERATED_SEARCH_ONLY_LOGGEDIN, public bool $MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY, public bool $MBIN_SSO_REGISTRATIONS_ENABLED, - public bool $MBIN_RESTRICT_MAGAZINE_CREATION + public bool $MBIN_RESTRICT_MAGAZINE_CREATION, + public bool $MBIN_SHOW_SOCIALS_FIRST ) { } @@ -60,6 +61,7 @@ public function mergeIntoDto(SettingsDto $dto): SettingsDto $dto->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY = $this->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY ?? $dto->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY; $dto->MBIN_SSO_REGISTRATIONS_ENABLED = $this->MBIN_SSO_REGISTRATIONS_ENABLED ?? $dto->MBIN_SSO_REGISTRATIONS_ENABLED; $dto->MBIN_RESTRICT_MAGAZINE_CREATION = $this->MBIN_RESTRICT_MAGAZINE_CREATION ?? $dto->MBIN_RESTRICT_MAGAZINE_CREATION; + $dto->MBIN_SHOW_SOCIALS_FIRST = $this->MBIN_SHOW_SOCIALS_FIRST ?? $dto->MBIN_SHOW_SOCIALS_FIRST; return $dto; } @@ -89,6 +91,7 @@ public function jsonSerialize(): mixed 'MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY' => $this->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY, 'MBIN_SSO_REGISTRATIONS_ENABLED' => $this->MBIN_SSO_REGISTRATIONS_ENABLED, 'MBIN_RESTRICT_MAGAZINE_CREATION' => $this->MBIN_RESTRICT_MAGAZINE_CREATION, + 'MBIN_SHOW_SOCIALS_FIRST' => $this->MBIN_SHOW_SOCIALS_FIRST, ]; } } diff --git a/src/Form/SettingsType.php b/src/Form/SettingsType.php index f0a9acee0..f25853775 100644 --- a/src/Form/SettingsType.php +++ b/src/Form/SettingsType.php @@ -39,6 +39,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('KBIN_FEDERATED_SEARCH_ONLY_LOGGEDIN', CheckboxType::class, ['required' => false]) ->add('MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY', CheckboxType::class, ['required' => false]) ->add('MBIN_RESTRICT_MAGAZINE_CREATION', CheckboxType::class, ['required' => false]) + ->add('MBIN_SHOW_SOCIALS_FIRST', CheckboxType::class, ['required' => false]) ->add('submit', SubmitType::class); } diff --git a/src/Service/SettingsManager.php b/src/Service/SettingsManager.php index 1227baed0..459f0860d 100644 --- a/src/Service/SettingsManager.php +++ b/src/Service/SettingsManager.php @@ -67,7 +67,8 @@ public function __construct( $this->find($results, 'KBIN_FEDERATED_SEARCH_ONLY_LOGGEDIN', FILTER_VALIDATE_BOOLEAN) ?? true, $this->find($results, 'MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY', FILTER_VALIDATE_BOOLEAN) ?? false, $this->find($results, 'MBIN_SSO_REGISTRATIONS_ENABLED', FILTER_VALIDATE_BOOLEAN) ?? true, - $this->find($results, 'MBIN_RESTRICT_MAGAZINE_CREATION', FILTER_VALIDATE_BOOLEAN) ?? false + $this->find($results, 'MBIN_RESTRICT_MAGAZINE_CREATION', FILTER_VALIDATE_BOOLEAN) ?? false, + $this->find($results, 'MBIN_SHOW_SOCIALS_FIRST', FILTER_VALIDATE_BOOLEAN) ?? false ); } } diff --git a/src/Twig/Extension/SettingsExtension.php b/src/Twig/Extension/SettingsExtension.php index 8ffce6714..bee15175c 100644 --- a/src/Twig/Extension/SettingsExtension.php +++ b/src/Twig/Extension/SettingsExtension.php @@ -28,6 +28,7 @@ public function getFunctions(): array new TwigFunction('kbin_federation_page_enabled', [SettingsExtensionRuntime::class, 'kbinFederationPageEnabled']), new TwigFunction('mbin_current_version', [SettingsExtensionRuntime::class, 'mbinCurrentVersion']), new TwigFunction('mbin_restrict_magazine_creation', [SettingsExtensionRuntime::class, 'mbinRestrictMagazineCreation']), + new TwigFunction('mbin_show_socials_first', [SettingsExtensionRuntime::class, 'mbinShowSocialsFirst']), ]; } } diff --git a/src/Twig/Runtime/SettingsExtensionRuntime.php b/src/Twig/Runtime/SettingsExtensionRuntime.php index bf95a1b76..a45ff9e1b 100644 --- a/src/Twig/Runtime/SettingsExtensionRuntime.php +++ b/src/Twig/Runtime/SettingsExtensionRuntime.php @@ -103,4 +103,9 @@ public function mbinRestrictMagazineCreation(): bool { return $this->settings->get('MBIN_RESTRICT_MAGAZINE_CREATION'); } + + public function mbinShowSocialsFirst(): bool + { + return $this->settings->get('MBIN_SHOW_SOCIALS_FIRST'); + } } diff --git a/templates/admin/settings.html.twig b/templates/admin/settings.html.twig index 2a33e1df4..f917f08d5 100644 --- a/templates/admin/settings.html.twig +++ b/templates/admin/settings.html.twig @@ -75,6 +75,10 @@ {{ form_label(form.MBIN_RESTRICT_MAGAZINE_CREATION, 'restrict_magazine_creation') }} {{ form_widget(form.MBIN_RESTRICT_MAGAZINE_CREATION) }}

+
+ {{ form_label(form.MBIN_SHOW_SOCIALS_FIRST, 'show_socials_first') }} + {{ form_widget(form.MBIN_SHOW_SOCIALS_FIRST) }} +
{{ form_row(form.submit, {label: 'save', attr: {class: 'btn btn__primary'}}) }}
diff --git a/templates/components/login_socials.html.twig b/templates/components/login_socials.html.twig index 7257e069a..48675d721 100644 --- a/templates/components/login_socials.html.twig +++ b/templates/components/login_socials.html.twig @@ -3,26 +3,27 @@
{% if this.googleEnabled %} - Google + {{ 'continue_with'|trans }} Google {% endif %} {% if this.facebookEnabled %} - Facebook + {{ 'continue_with'|trans }} Facebook {% endif %} {% if this.githubEnabled %} - GitHub + {{ 'continue_with'|trans }} GitHub {% endif %} {% if this.keycloakEnabled %} - Keycloak + {{ 'continue_with'|trans }} Keycloak {% endif %} {% if this.zitadelEnabled %} - Zitadel + {{ 'continue_with'|trans }} Zitadel {% endif %} {% if this.azureEnabled %} - Microsoft + {{ 'continue_with'|trans }} Microsoft {% endif %}
+
diff --git a/templates/user/login.html.twig b/templates/user/login.html.twig index 8d01353b8..3a9d89516 100644 --- a/templates/user/login.html.twig +++ b/templates/user/login.html.twig @@ -17,6 +17,9 @@ {% include 'layout/_flash.html.twig' %}
+ {% if mbin_show_socials_first() %} + {{ component('login_socials') }} + {% endif %} {% if not_sso_only_mode %}
{% if error %} @@ -47,7 +50,9 @@
{% endif %} - {{ component('login_socials') }} + {% if not mbin_show_socials_first() %} + {{ component('login_socials') }} + {% endif %} {% if not_sso_only_mode %} {{ component('user_form_actions', {showRegister: true, showPasswordReset: true, showResendEmail: true}) }} {% endif %} diff --git a/templates/user/register.html.twig b/templates/user/register.html.twig index 294ef637f..8cd5db89a 100644 --- a/templates/user/register.html.twig +++ b/templates/user/register.html.twig @@ -16,6 +16,9 @@

{{ 'register'|trans }}

+ {% if mbin_sso_registrations_enabled() and mbin_show_socials_first() %} + {{ component('login_socials') }} + {% endif %} {% if kbin_registrations_enabled() %} {{ form_start(form) }} {% for flash_error in app.flashes('verify_email_error') %} @@ -61,7 +64,7 @@ {% else %}

{{ 'registration_disabled'|trans }}

{% endif %} - {% if mbin_sso_registrations_enabled() %} + {% if mbin_sso_registrations_enabled() and not mbin_show_socials_first() %} {{ component('login_socials') }} {% endif %} {{ component('user_form_actions', {showLogin: true, showPasswordReset: true, showResendEmail: true}) }} diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 88c89a1df..7fdc251b9 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -811,3 +811,5 @@ sso_registrations_enabled: SSO registrations enabled sso_registrations_enabled.error: New account registrations with third-party identity managers are currently disabled. related_entry: Related restrict_magazine_creation: Restrict local magazine creation to admins and global mods +show_socials_first: Show social buttons first on login and registration pages +continue_with: Continue with From 637884639f504ed6d0a1bf29e3d0b19fe90703ae Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 4 May 2024 08:46:16 -0400 Subject: [PATCH 5/9] hide separators based on social first --- assets/styles/components/_login.scss | 2 +- templates/components/login_socials.html.twig | 4 ++++ templates/user/login.html.twig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index 0401a1add..ec523ab8f 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -19,7 +19,7 @@ display: none; height: 0; } - form ~ .separator:has(+ div a), .separator:has(+ div a), .separator:has(+ div p) { + .separator:has(+ div a), .separator:has(+ div p) { display: block; border: var(--kbin-section-border); height: 0; diff --git a/templates/components/login_socials.html.twig b/templates/components/login_socials.html.twig index 48675d721..d66ff36ca 100644 --- a/templates/components/login_socials.html.twig +++ b/templates/components/login_socials.html.twig @@ -1,5 +1,7 @@ {# @var this App\Twig\Components\LoginSocialsComponent #} +{% if not mbin_sso_only_mode() and not mbin_show_socials_first() %}
+{% endif %} +{% if not mbin_sso_only_mode() and mbin_show_socials_first() %}
+{% endif %} diff --git a/templates/user/login.html.twig b/templates/user/login.html.twig index d6210cc17..fc3160d40 100644 --- a/templates/user/login.html.twig +++ b/templates/user/login.html.twig @@ -53,7 +53,7 @@ {% if not mbin_show_socials_first() %} {{ component('login_socials') }} {% endif %} - {% if not_sso_only_mode %} + {% if not mbin_sso_only_mode() %} {{ component('user_form_actions', {showRegister: true, showPasswordReset: true, showResendEmail: true}) }} {% endif %}
From 186270b1ae31d71d4f85a66bae8469e97c1ac5c0 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 4 May 2024 09:17:43 -0400 Subject: [PATCH 6/9] use more reliable check if any sso is set increase margin slightly remove entire socials div when no socials as the div was adding extra space to the layout even when empty rename style class to say half as there might be a use case for full width buttons --- assets/styles/components/_login.scss | 4 +- assets/styles/layout/_forms.scss | 2 +- templates/components/login_socials.html.twig | 61 ++++++++++---------- templates/reset_password/request.html.twig | 2 +- templates/reset_password/reset.html.twig | 2 +- templates/user/login.html.twig | 2 +- templates/user/register.html.twig | 2 +- 7 files changed, 39 insertions(+), 36 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index ec523ab8f..3b20f74ea 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -19,11 +19,11 @@ display: none; height: 0; } - .separator:has(+ div a), .separator:has(+ div p) { + .separator:has(+ div p), .separator.separator-show { display: block; border: var(--kbin-section-border); height: 0; - margin: 15px 30px; + margin: 20px 30px; } .actions { diff --git a/assets/styles/layout/_forms.scss b/assets/styles/layout/_forms.scss index edc4f2eb9..2a45e5afb 100644 --- a/assets/styles/layout/_forms.scss +++ b/assets/styles/layout/_forms.scss @@ -434,7 +434,7 @@ select { } } -.button-flex { +.button-flex-hf { text-align: center; button { width: 50%; diff --git a/templates/components/login_socials.html.twig b/templates/components/login_socials.html.twig index d66ff36ca..29178da3a 100644 --- a/templates/components/login_socials.html.twig +++ b/templates/components/login_socials.html.twig @@ -1,33 +1,36 @@ {# @var this App\Twig\Components\LoginSocialsComponent #} -{% if not mbin_sso_only_mode() and not mbin_show_socials_first() %} -
-{% endif %} - -{% if not mbin_sso_only_mode() and mbin_show_socials_first() %} -
{% endif %} diff --git a/templates/reset_password/request.html.twig b/templates/reset_password/request.html.twig index daba63a2f..d4b8c811a 100644 --- a/templates/reset_password/request.html.twig +++ b/templates/reset_password/request.html.twig @@ -24,7 +24,7 @@ label: 'email' }) }} -
+
{{ form_end(form) }} diff --git a/templates/reset_password/reset.html.twig b/templates/reset_password/reset.html.twig index 2b3504479..3582a7074 100644 --- a/templates/reset_password/reset.html.twig +++ b/templates/reset_password/reset.html.twig @@ -22,7 +22,7 @@ {% endfor %} {{ form_row(form.plainPassword) }} -
+
{{ form_end(form) }} diff --git a/templates/user/login.html.twig b/templates/user/login.html.twig index fc3160d40..dd489b4d6 100644 --- a/templates/user/login.html.twig +++ b/templates/user/login.html.twig @@ -45,7 +45,7 @@
-
+
diff --git a/templates/user/register.html.twig b/templates/user/register.html.twig index 8cd5db89a..544142f42 100644 --- a/templates/user/register.html.twig +++ b/templates/user/register.html.twig @@ -57,7 +57,7 @@ class: 'btn btn__primary' }, row_attr: { - class: 'button-flex' + class: 'button-flex-hf' } }) }} {{ form_end(form) }} From 3fca33cd1107e6f38e7d79b9d7f55aa6307c2134 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 4 May 2024 21:33:38 -0400 Subject: [PATCH 7/9] add styling to resent activation email page --- templates/resend_verification_email/resend.html.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/resend_verification_email/resend.html.twig b/templates/resend_verification_email/resend.html.twig index 634fa8a28..6f69aef31 100644 --- a/templates/resend_verification_email/resend.html.twig +++ b/templates/resend_verification_email/resend.html.twig @@ -27,7 +27,11 @@ {% endfor %} {{ form_row(form.email) }} - {{ form_row(form.submit) }} + {{ form_row(form.submit, { + row_attr: { + class: 'button-flex-hf' + } + }) }} {{ form_end(form) }} {{ component('user_form_actions', {showRegister: true, showPasswordReset: true, showResendEmail: true}) }} From 1b6cbb35eb8ee5d0ac6b1d96ac1f658668cb0c3a Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 4 May 2024 22:04:36 -0400 Subject: [PATCH 8/9] rename var to be consistent with sso naming --- src/DTO/SettingsDto.php | 6 +++--- src/Form/SettingsType.php | 2 +- src/Service/SettingsManager.php | 2 +- src/Twig/Extension/SettingsExtension.php | 2 +- src/Twig/Runtime/SettingsExtensionRuntime.php | 2 +- templates/admin/settings.html.twig | 4 ++-- templates/components/login_socials.html.twig | 4 ++-- templates/user/login.html.twig | 4 ++-- templates/user/register.html.twig | 4 ++-- translations/messages.en.yaml | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/DTO/SettingsDto.php b/src/DTO/SettingsDto.php index a3634eb98..539f75005 100644 --- a/src/DTO/SettingsDto.php +++ b/src/DTO/SettingsDto.php @@ -35,7 +35,7 @@ public function __construct( public bool $MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY, public bool $MBIN_SSO_REGISTRATIONS_ENABLED, public bool $MBIN_RESTRICT_MAGAZINE_CREATION, - public bool $MBIN_SHOW_SOCIALS_FIRST + public bool $MBIN_SSO_SHOW_FIRST ) { } @@ -65,7 +65,7 @@ public function mergeIntoDto(SettingsDto $dto): SettingsDto $dto->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY = $this->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY ?? $dto->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY; $dto->MBIN_SSO_REGISTRATIONS_ENABLED = $this->MBIN_SSO_REGISTRATIONS_ENABLED ?? $dto->MBIN_SSO_REGISTRATIONS_ENABLED; $dto->MBIN_RESTRICT_MAGAZINE_CREATION = $this->MBIN_RESTRICT_MAGAZINE_CREATION ?? $dto->MBIN_RESTRICT_MAGAZINE_CREATION; - $dto->MBIN_SHOW_SOCIALS_FIRST = $this->MBIN_SHOW_SOCIALS_FIRST ?? $dto->MBIN_SHOW_SOCIALS_FIRST; + $dto->MBIN_SSO_SHOW_FIRST = $this->MBIN_SSO_SHOW_FIRST ?? $dto->MBIN_SSO_SHOW_FIRST; return $dto; } @@ -97,7 +97,7 @@ public function jsonSerialize(): mixed 'MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY' => $this->MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY, 'MBIN_SSO_REGISTRATIONS_ENABLED' => $this->MBIN_SSO_REGISTRATIONS_ENABLED, 'MBIN_RESTRICT_MAGAZINE_CREATION' => $this->MBIN_RESTRICT_MAGAZINE_CREATION, - 'MBIN_SHOW_SOCIALS_FIRST' => $this->MBIN_SHOW_SOCIALS_FIRST, + 'MBIN_SSO_SHOW_FIRST' => $this->MBIN_SSO_SHOW_FIRST, ]; } } diff --git a/src/Form/SettingsType.php b/src/Form/SettingsType.php index 0bd20015a..a7bef3954 100644 --- a/src/Form/SettingsType.php +++ b/src/Form/SettingsType.php @@ -41,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('KBIN_FEDERATED_SEARCH_ONLY_LOGGEDIN', CheckboxType::class, ['required' => false]) ->add('MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY', CheckboxType::class, ['required' => false]) ->add('MBIN_RESTRICT_MAGAZINE_CREATION', CheckboxType::class, ['required' => false]) - ->add('MBIN_SHOW_SOCIALS_FIRST', CheckboxType::class, ['required' => false]) + ->add('MBIN_SSO_SHOW_FIRST', CheckboxType::class, ['required' => false]) ->add('submit', SubmitType::class); } diff --git a/src/Service/SettingsManager.php b/src/Service/SettingsManager.php index 632d83c4b..11ac26645 100644 --- a/src/Service/SettingsManager.php +++ b/src/Service/SettingsManager.php @@ -71,7 +71,7 @@ public function __construct( $this->find($results, 'MBIN_SIDEBAR_SECTIONS_LOCAL_ONLY', FILTER_VALIDATE_BOOLEAN) ?? false, $this->find($results, 'MBIN_SSO_REGISTRATIONS_ENABLED', FILTER_VALIDATE_BOOLEAN) ?? true, $this->find($results, 'MBIN_RESTRICT_MAGAZINE_CREATION', FILTER_VALIDATE_BOOLEAN) ?? false, - $this->find($results, 'MBIN_SHOW_SOCIALS_FIRST', FILTER_VALIDATE_BOOLEAN) ?? false + $this->find($results, 'MBIN_SSO_SHOW_FIRST', FILTER_VALIDATE_BOOLEAN) ?? false ); } } diff --git a/src/Twig/Extension/SettingsExtension.php b/src/Twig/Extension/SettingsExtension.php index 594908d71..c3981962e 100644 --- a/src/Twig/Extension/SettingsExtension.php +++ b/src/Twig/Extension/SettingsExtension.php @@ -30,7 +30,7 @@ public function getFunctions(): array new TwigFunction('mbin_current_version', [SettingsExtensionRuntime::class, 'mbinCurrentVersion']), new TwigFunction('mbin_restrict_magazine_creation', [SettingsExtensionRuntime::class, 'mbinRestrictMagazineCreation']), new TwigFunction('mbin_private_instance', [SettingsExtensionRuntime::class, 'mbinPrivateInstance']), - new TwigFunction('mbin_show_socials_first', [SettingsExtensionRuntime::class, 'mbinShowSocialsFirst']), + new TwigFunction('mbin_sso_show_first', [SettingsExtensionRuntime::class, 'mbinSsoShowFirst']), ]; } } diff --git a/src/Twig/Runtime/SettingsExtensionRuntime.php b/src/Twig/Runtime/SettingsExtensionRuntime.php index 07e4508fc..120cc9e41 100644 --- a/src/Twig/Runtime/SettingsExtensionRuntime.php +++ b/src/Twig/Runtime/SettingsExtensionRuntime.php @@ -116,6 +116,6 @@ public function mbinPrivateInstance(): bool public function mbinShowSocialsFirst(): bool { - return $this->settings->get('MBIN_SHOW_SOCIALS_FIRST'); + return $this->settings->get('MBIN_SSO_SHOW_FIRST'); } } diff --git a/templates/admin/settings.html.twig b/templates/admin/settings.html.twig index 56cbcd929..e2ef8d96a 100644 --- a/templates/admin/settings.html.twig +++ b/templates/admin/settings.html.twig @@ -84,8 +84,8 @@ {{ form_widget(form.MBIN_RESTRICT_MAGAZINE_CREATION) }}
- {{ form_label(form.MBIN_SHOW_SOCIALS_FIRST, 'show_socials_first') }} - {{ form_widget(form.MBIN_SHOW_SOCIALS_FIRST) }} + {{ form_label(form.MBIN_SSO_SHOW_FIRST, 'sso_show_first') }} + {{ form_widget(form.MBIN_SSO_SHOW_FIRST) }}
{{ form_row(form.submit, {label: 'save', attr: {class: 'btn btn__primary'}}) }} diff --git a/templates/components/login_socials.html.twig b/templates/components/login_socials.html.twig index 29178da3a..117a89758 100644 --- a/templates/components/login_socials.html.twig +++ b/templates/components/login_socials.html.twig @@ -1,7 +1,7 @@ {# @var this App\Twig\Components\LoginSocialsComponent #} {%- set HAS_ANY_SOCIAL = this.googleEnabled or this.facebookEnabled or this.githubEnabled or this.keycloakEnabled or this.zitadelEnabled or this.azureEnabled -%} {% if HAS_ANY_SOCIAL %} - {% if not mbin_sso_only_mode() and not mbin_show_socials_first() %} + {% if not mbin_sso_only_mode() and not mbin_sso_show_first() %}
{% endif %} - {% if not mbin_sso_only_mode() and mbin_show_socials_first() %} + {% if not mbin_sso_only_mode() and mbin_sso_show_first() %}
{% endif %} {% endif %} diff --git a/templates/user/login.html.twig b/templates/user/login.html.twig index dd489b4d6..b15fef738 100644 --- a/templates/user/login.html.twig +++ b/templates/user/login.html.twig @@ -17,7 +17,7 @@ {% include 'layout/_flash.html.twig' %}
- {% if mbin_show_socials_first() %} + {% if mbin_sso_show_first() %} {{ component('login_socials') }} {% endif %} {% if not mbin_sso_only_mode() %} @@ -50,7 +50,7 @@
{% endif %} - {% if not mbin_show_socials_first() %} + {% if not mbin_sso_show_first() %} {{ component('login_socials') }} {% endif %} {% if not mbin_sso_only_mode() %} diff --git a/templates/user/register.html.twig b/templates/user/register.html.twig index 544142f42..ae2561e98 100644 --- a/templates/user/register.html.twig +++ b/templates/user/register.html.twig @@ -16,7 +16,7 @@

{{ 'register'|trans }}

- {% if mbin_sso_registrations_enabled() and mbin_show_socials_first() %} + {% if mbin_sso_registrations_enabled() and mbin_sso_show_first() %} {{ component('login_socials') }} {% endif %} {% if kbin_registrations_enabled() %} @@ -64,7 +64,7 @@ {% else %}

{{ 'registration_disabled'|trans }}

{% endif %} - {% if mbin_sso_registrations_enabled() and not mbin_show_socials_first() %} + {% if mbin_sso_registrations_enabled() and not mbin_sso_show_first() %} {{ component('login_socials') }} {% endif %} {{ component('user_form_actions', {showLogin: true, showPasswordReset: true, showResendEmail: true}) }} diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index d8bcd06a5..8d6185de8 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -813,5 +813,5 @@ sso_registrations_enabled.error: New account registrations with third-party iden sso_only_mode: Restrict login and registration to SSO methods only related_entry: Related restrict_magazine_creation: Restrict local magazine creation to admins and global mods -show_socials_first: Show social buttons first on login and registration pages +sso_show_first: Show SSO first on login and registration pages continue_with: Continue with From 98ce840fc1fc6040bad4bdd9f6d1f705ce7c7cc8 Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Sat, 4 May 2024 22:56:08 -0400 Subject: [PATCH 9/9] fix missed rename --- src/Twig/Runtime/SettingsExtensionRuntime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twig/Runtime/SettingsExtensionRuntime.php b/src/Twig/Runtime/SettingsExtensionRuntime.php index 120cc9e41..6f5ce0ea5 100644 --- a/src/Twig/Runtime/SettingsExtensionRuntime.php +++ b/src/Twig/Runtime/SettingsExtensionRuntime.php @@ -114,7 +114,7 @@ public function mbinPrivateInstance(): bool return $this->settings->get('MBIN_PRIVATE_INSTANCE'); } - public function mbinShowSocialsFirst(): bool + public function mbinSsoShowFirst(): bool { return $this->settings->get('MBIN_SSO_SHOW_FIRST'); }