{{ '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') %}From 701d654d21d6100e882bfe1119a469ff304c068a Mon Sep 17 00:00:00 2001 From: e-five <146029455+e-five256@users.noreply.github.com> Date: Fri, 10 May 2024 19:52:58 -0400 Subject: [PATCH] Restyle login/register social and action button sections (#706) --- assets/styles/components/_login.scss | 29 +++++++--- assets/styles/layout/_forms.scss | 11 ++++ 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 | 57 +++++++++++-------- .../components/user_form_actions.html.twig | 11 ++-- .../resend.html.twig | 10 +++- templates/reset_password/request.html.twig | 3 +- templates/reset_password/reset.html.twig | 3 +- templates/user/login.html.twig | 11 +++- templates/user/register.html.twig | 9 ++- translations/messages.en.yaml | 2 + 16 files changed, 115 insertions(+), 50 deletions(-) diff --git a/assets/styles/components/_login.scss b/assets/styles/components/_login.scss index 7fe9c5a7d..3b20f74ea 100644 --- a/assets/styles/components/_login.scss +++ b/assets/styles/components/_login.scss @@ -15,21 +15,36 @@ font-weight: bold; } + .separator { + display: none; + height: 0; + } + .separator:has(+ div p), .separator.separator-show { + display: block; + border: var(--kbin-section-border); + height: 0; + margin: 20px 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..2a45e5afb 100644 --- a/assets/styles/layout/_forms.scss +++ b/assets/styles/layout/_forms.scss @@ -434,6 +434,17 @@ select { } } +.button-flex-hf { + text-align: center; + button { + width: 50%; + + @include media-breakpoint-down(lg) { + width: 100%; + } + } +} + .actions { @include media-breakpoint-down(sm) { text-align: right; diff --git a/src/DTO/SettingsDto.php b/src/DTO/SettingsDto.php index 6c4ccd542..539f75005 100644 --- a/src/DTO/SettingsDto.php +++ b/src/DTO/SettingsDto.php @@ -34,7 +34,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_SSO_SHOW_FIRST ) { } @@ -64,6 +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_SSO_SHOW_FIRST = $this->MBIN_SSO_SHOW_FIRST ?? $dto->MBIN_SSO_SHOW_FIRST; return $dto; } @@ -95,6 +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_SSO_SHOW_FIRST' => $this->MBIN_SSO_SHOW_FIRST, ]; } } diff --git a/src/Form/SettingsType.php b/src/Form/SettingsType.php index e0cbf609b..a7bef3954 100644 --- a/src/Form/SettingsType.php +++ b/src/Form/SettingsType.php @@ -41,6 +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_SSO_SHOW_FIRST', CheckboxType::class, ['required' => false]) ->add('submit', SubmitType::class); } diff --git a/src/Service/SettingsManager.php b/src/Service/SettingsManager.php index 60923060e..11ac26645 100644 --- a/src/Service/SettingsManager.php +++ b/src/Service/SettingsManager.php @@ -70,7 +70,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_SSO_SHOW_FIRST', FILTER_VALIDATE_BOOLEAN) ?? false ); } } diff --git a/src/Twig/Extension/SettingsExtension.php b/src/Twig/Extension/SettingsExtension.php index 6573a3244..c3981962e 100644 --- a/src/Twig/Extension/SettingsExtension.php +++ b/src/Twig/Extension/SettingsExtension.php @@ -30,6 +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_sso_show_first', [SettingsExtensionRuntime::class, 'mbinSsoShowFirst']), ]; } } diff --git a/src/Twig/Runtime/SettingsExtensionRuntime.php b/src/Twig/Runtime/SettingsExtensionRuntime.php index 229f3502d..6f5ce0ea5 100644 --- a/src/Twig/Runtime/SettingsExtensionRuntime.php +++ b/src/Twig/Runtime/SettingsExtensionRuntime.php @@ -113,4 +113,9 @@ public function mbinPrivateInstance(): bool { return $this->settings->get('MBIN_PRIVATE_INSTANCE'); } + + public function mbinSsoShowFirst(): bool + { + return $this->settings->get('MBIN_SSO_SHOW_FIRST'); + } } diff --git a/templates/admin/settings.html.twig b/templates/admin/settings.html.twig index 4588840a4..e2ef8d96a 100644 --- a/templates/admin/settings.html.twig +++ b/templates/admin/settings.html.twig @@ -83,6 +83,10 @@ {{ form_label(form.MBIN_RESTRICT_MAGAZINE_CREATION, 'restrict_magazine_creation') }} {{ form_widget(form.MBIN_RESTRICT_MAGAZINE_CREATION) }} +
{{ '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 %}#} -{{ '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') %}