Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify login form view customization #1686

Merged
merged 2 commits into from Dec 30, 2020
Merged

Conversation

adamwojs
Copy link
Member

@adamwojs adamwojs commented Dec 29, 2020

Question Answer
Tickets -
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? yes
License GPL-2.0

In order to simplify login form template (src/bundle/Resources/views/themes/admin/account/login/index.html.twig) customization:

  • Restructured template using blocks
  • Added login-form-before and login-form-after components groups

Example use case

Assuming that as a Developer I would like to would like to add "Login via XYZ" button to login form. 

  1. Create  /templates/login_via_oauth2.html.twig
<div class="row mt-4">
    <div class="col">
        <p class="text-center">or</p>

        <div class="btn-group d-flex">
            <a href="#" class="btn btn-primary mr-1">
                Login via Google
            </a>

            <a href="#" class="btn btn-primary ml-1">
                Login via  Microsoft
            </a>
        </div>
    </div>
</div>

2. Add component definition to /config/services.yaml:

    app.components.login_via_aouth2:
        parent: EzSystems\EzPlatformAdminUi\Component\TwigComponent
        arguments:
            $template: 'login_via_oauth2.html.twig'
        tags:
            - { name: ezplatform.admin_ui.component, group: login-form-after }

3. Done. 

image

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

@adamwojs adamwojs requested review from kmadejski and a team December 29, 2020 13:51
@adamwojs adamwojs self-assigned this Dec 29, 2020
@bogusez
Copy link
Contributor

bogusez commented Dec 30, 2020

@adamwojs is this new buttons are just mockups? I'm asking because when I'm clicking on them nothing happens (no errors in console etc).

@adamwojs
Copy link
Member Author

This PR is only about introducing new extension points to login form view. Login will not gonna work without ibexa/oauth2-client and few other steps 🙃

@bogusez
Copy link
Contributor

bogusez commented Dec 30, 2020

This PR is only about introducing new extension points to login form view. Login will not gonna work without ibexa/oauth2-client and few other steps 🙃

OK thank you :)

@lserwatka
Copy link
Member

Let's not waste time on this one and merge it as it is.

@bogusez
Copy link
Contributor

bogusez commented Dec 30, 2020

Let's not waste time on this one and merge it as it is.

It's ready to be merge

@lserwatka
Copy link
Member

We need to document this example

@lserwatka lserwatka merged commit 559ca2c into master Dec 30, 2020
@lserwatka lserwatka deleted the login_form_ext_point branch December 30, 2020 09:51
@lserwatka
Copy link
Member

@ezsystems/documentation-team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants