This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrated support for FOSUserBundle
- Loading branch information
1 parent
53a15a7
commit 2901667
Showing
18 changed files
with
381 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# FOSUserBundle integration | ||
|
||
This bundle is prepared for a flawless integration with FOSUserBundle, but its not coming out-of-the-box. | ||
|
||
First follow the [installation instruction for the FOSUserBundle](http://symfony.com/doc/current/bundles/FOSUserBundle/index.html) and | ||
configure it to your needs. | ||
|
||
Then integrate it with the AdminLTEBundle as follows. | ||
|
||
## config/packages/admin_lte.yaml | ||
|
||
```yaml | ||
admin_lte: | ||
routes: | ||
adminlte_login: fos_user_security_login | ||
adminlte_login_check: fos_user_security_check | ||
adminlte_registration: fos_user_registration_register | ||
adminlte_password_reset: fos_user_resetting_request | ||
``` | ||
If you don't want the "password reset" and/or "register account" functionality, | ||
simply remove the configuration keys `adminlte_password_reset` and `adminlte_registration`. | ||
|
||
## templates/bundles/FOSUserBundle | ||
|
||
Create the directory with the following file structure: | ||
|
||
``` | ||
// YouAppRoot/templates/bundles/ | ||
─ FOSUserBundle | ||
└── views | ||
├── Registration | ||
│ ├── confirmed.html.twig | ||
│ └── register.html.twig | ||
├── Resetting | ||
│ └── request.html.twig | ||
├── Security | ||
│ └── login.html.twig | ||
└── layout.html.twig | ||
``` | ||
|
||
Add the following files with the following minimal structure, | ||
you might want to overwrite the block `logo_login` to display your app name: | ||
|
||
### Registration/register.html.twig | ||
|
||
``` | ||
{% extends '@AdminLTE/FOSUserBundle/Registration/confirmed.html.twig' %} | ||
``` | ||
### Registration/register.html.twig | ||
``` | ||
{% extends '@AdminLTE/FOSUserBundle/Registration/register.html.twig' %} | ||
``` | ||
### Resetting/request.html.twig | ||
``` | ||
{% extends '@AdminLTE/FOSUserBundle/Resetting/request.html.twig' %} | ||
``` | ||
### Security/login.html.twig | ||
``` | ||
{% extends '@AdminLTE/FOSUserBundle/Security/login.html.twig' %} | ||
``` | ||
### layout.html.twig | ||
This example includes an (optional) changed application name: | ||
``` | ||
{% extends '@AdminLTE/FOSUserBundle/layout.html.twig' %} | ||
{% block logo_login %}<b>Demo</b><br>Application{% endblock %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Resources/views/FOSUserBundle/Registration/confirmed.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends '@AdminLTE/layout/security-layout.html.twig' %} | ||
|
||
{% block login_social_auth %}{% endblock %} | ||
|
||
{% block login_form %} | ||
{% block fos_user_content %} | ||
<p>{{ 'registration.confirmed'|trans({'%username%': user.username}, 'FOSUserBundle') }}</p> | ||
{% endblock fos_user_content %} | ||
{% endblock %} | ||
|
||
{% block login_actions %} | ||
<br> | ||
<a href="{{ path('adminlte_welcome'|route_alias) }}"> | ||
{{ 'Show homepage'|trans({}, 'AdminLTEBundle') }} | ||
</a> | ||
{% endblock %} |
25 changes: 25 additions & 0 deletions
25
Resources/views/FOSUserBundle/Registration/register.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends '@AdminLTE/layout/security-layout.html.twig' %} | ||
|
||
{% block login_social_auth %}{% endblock %} | ||
|
||
{% block login_box_msg %} | ||
{{ 'Register a new account'|trans({}, 'AdminLTEBundle') }} | ||
{% endblock %} | ||
|
||
{% block login_form %} | ||
{% trans_default_domain 'FOSUserBundle' %} | ||
|
||
{{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register'}}) }} | ||
{{ form_widget(form) }} | ||
<div class="form-group"> | ||
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'registration.submit'|trans }}</button> | ||
</div> | ||
{{ form_end(form) }} | ||
{% endblock %} | ||
|
||
{% block login_actions %} | ||
<br> | ||
<a href="{{ path('adminlte_login'|route_alias) }}"> | ||
{{ 'Back to login'|trans({}, 'AdminLTEBundle') }} | ||
</a> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends '@AdminLTE/layout/security-layout.html.twig' %} | ||
|
||
{% block login_social_auth %}{% endblock %} | ||
|
||
{% block login_box_msg %} | ||
{{ 'Reset your password'|trans({}, 'AdminLTEBundle') }} | ||
{% endblock %} | ||
|
||
{% block login_form %} | ||
{% trans_default_domain 'FOSUserBundle' %} | ||
|
||
<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="fos_user_resetting_request"> | ||
<div class="form-group has-feedback"> | ||
<input type="text" id="username" name="username" required="required" class="form-control" placeholder="{{ 'resetting.request.username'|trans }}"> | ||
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'resetting.request.submit'|trans }}</button> | ||
</div> | ||
</div> | ||
</form> | ||
{% endblock %} | ||
|
||
{% block login_actions %} | ||
<br> | ||
<a href="{{ path('adminlte_login'|route_alias) }}"> | ||
{{ 'Back to login'|trans({}, 'AdminLTEBundle') }} | ||
</a> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends '@AdminLTE/layout/security-layout.html.twig' %} | ||
|
||
{% block login_social_auth %}{% endblock %} | ||
|
||
{% block login_box_msg %} | ||
{{ 'Sign in to start your session'|trans({}, 'AdminLTEBundle') }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends '@AdminLTE/layout/security-layout.html.twig' %} | ||
|
||
{% block login_social_auth %}{% endblock %} | ||
|
||
{% block login_form %} | ||
{% block fos_user_content %}{% endblock %} | ||
{% endblock %} | ||
|
||
{% block login_actions %} | ||
<br> | ||
<a href="{{ path('adminlte_login'|route_alias) }}"> | ||
{{ 'Back to login'|trans({}, 'AdminLTEBundle') }} | ||
</a> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.