Permalink
Browse files

FOSUserBundle integrated

issues:
- FOSUserBundle integration #6
- personalize login page #8
- personalization of registration emails #7
  • Loading branch information...
inmarelibero committed Oct 5, 2012
1 parent ea1a582 commit 210157f14205253672fc495358692742ae153467
Showing with 742 additions and 53 deletions.
  1. +6 −0 app/AppKernel.php
  2. +34 −1 app/config/config.yml
  3. +3 −4 app/config/parameters.yml
  4. +27 −0 app/config/routing.yml
  5. +23 −36 app/config/security.yml
  6. +3 −1 composer.json
  7. +71 −1 composer.lock
  8. +23 −6 src/Bricks/SiteBundle/Resources/views/Default/index.html.twig
  9. +25 −3 src/Bricks/SiteBundle/Resources/views/layout.html.twig
  10. +16 −0 src/Bricks/UserBundle/BricksUserBundle.php
  11. +28 −0 src/Bricks/UserBundle/DependencyInjection/BricksUserExtension.php
  12. +29 −0 src/Bricks/UserBundle/DependencyInjection/Configuration.php
  13. +25 −0 src/Bricks/UserBundle/Entity/User.php
  14. +20 −0 src/Bricks/UserBundle/Resources/config/services.xml
  15. +22 −0 src/Bricks/UserBundle/Resources/views/ChangePassword/changePassword.html.twig
  16. +22 −0 src/Bricks/UserBundle/Resources/views/Profile/edit.html.twig
  17. +17 −0 src/Bricks/UserBundle/Resources/views/Profile/show.html.twig
  18. +29 −0 src/Bricks/UserBundle/Resources/views/Registration/checkEmail.html.twig
  19. +25 −0 src/Bricks/UserBundle/Resources/views/Registration/confirmed.html.twig
  20. +22 −0 src/Bricks/UserBundle/Resources/views/Registration/register.html.twig
  21. +28 −0 src/Bricks/UserBundle/Resources/views/Registration/registration.email.twig
  22. +23 −0 src/Bricks/UserBundle/Resources/views/Resetting/checkEmail.html.twig
  23. +23 −0 src/Bricks/UserBundle/Resources/views/Resetting/passwordAlreadyRequested.html.twig
  24. +36 −0 src/Bricks/UserBundle/Resources/views/Resetting/request.html.twig
  25. +28 −0 src/Bricks/UserBundle/Resources/views/Resetting/reset.html.twig
  26. +28 −0 src/Bricks/UserBundle/Resources/views/Resetting/resetting.email.twig
  27. +38 −0 src/Bricks/UserBundle/Resources/views/Security/login.html.twig
  28. +5 −0 src/Bricks/UserBundle/Resources/views/layout.html.twig
  29. +33 −0 web/css/layout.less
  30. +3 −0 web/css/main.less
  31. +1 −1 web/css/section-contribute.less
  32. +26 −0 web/css/security.less
View
@@ -19,7 +19,13 @@ public function registerBundles()
new JMS\AopBundle\JMSAopBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
+
+ // FOSUserBundle
+ new FOS\UserBundle\FOSUserBundle(),
+
+ // Bricks bundles
new Bricks\SiteBundle\BricksSiteBundle(),
+ new Bricks\UserBundle\BricksUserBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
View
@@ -2,9 +2,12 @@ imports:
- { resource: parameters.yml }
- { resource: security.yml }
+parameters:
+ locale: en #default locale
+
framework:
#esi: ~
- #translator: { fallback: %locale% }
+ translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
@@ -57,3 +60,33 @@ swiftmailer:
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
+
+fos_user:
+ db_driver: orm
+ firewall_name: main
+ user_class: Bricks\UserBundle\Entity\User
+
+ from_email:
+ address: contact@symfonybricks.com
+ sender_name: SymfonyBricks.com
+
+ service:
+ mailer: fos_user.mailer.twig_swift
+
+ registration:
+ confirmation:
+ enabled: true
+ template: BricksUserBundle:Registration:registration.email.twig
+
+ resetting:
+ email:
+ template: BricksUserBundle:Resetting:resetting.email.twig
+
+
+
+
+
+
+
+
+
@@ -2,14 +2,13 @@ parameters:
database_driver: pdo_mysql
database_host: localhost
database_port: ~
- database_name: symfony
- database_user: root
- database_password: ~
+ database_name: symfonybricks
+ database_user: [change-me]
+ database_password: [change-me]
mailer_transport: smtp
mailer_host: localhost
mailer_user: ~
mailer_password: ~
- locale: en
secret: ThisTokenIsNotSoSecretChangeIt
View
@@ -1,8 +1,35 @@
+# Bricks routes
+bricks_user:
+ resource: "@BricksUserBundle/Controller/"
+ type: annotation
+ prefix: /
+
bricks_site:
resource: "@BricksSiteBundle/Controller/"
type: annotation
prefix: /
+# FOSUserBundle routes
+fos_user_security:
+ resource: "@FOSUserBundle/Resources/config/routing/security.xml"
+
+fos_user_profile:
+ resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
+ prefix: /profile
+
+fos_user_register:
+ resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
+ prefix: /register
+
+fos_user_resetting:
+ resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
+ prefix: /resetting
+
+fos_user_change_password:
+ resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
+ prefix: /profile
+
+
# Internal routing configuration to handle ESI
#_internal:
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
View
@@ -1,43 +1,30 @@
-jms_security_extra:
- secure_all_services: false
- expressions: true
-
security:
- encoders:
- Symfony\Component\Security\Core\User\User: plaintext
-
- role_hierarchy:
- ROLE_ADMIN: ROLE_USER
- ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
-
providers:
- in_memory:
- memory:
- users:
- user: { password: userpass, roles: [ 'ROLE_USER' ] }
- admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
+ fos_userbundle:
+ id: fos_user.user_provider.username
- firewalls:
- dev:
- pattern: ^/(_(profiler|wdt)|css|images|js)/
- security: false
-
- login:
- pattern: ^/demo/secured/login$
- security: false
+ encoders:
+ FOS\UserBundle\Model\UserInterface: sha512
- secured_area:
- pattern: ^/demo/secured/
+ firewalls:
+ main:
+ pattern: ^/
form_login:
- check_path: /demo/secured/login_check
- login_path: /demo/secured/login
- logout:
- path: /demo/secured/logout
- target: /demo/
- #anonymous: ~
- #http_basic:
- # realm: "Secured Demo Area"
+ provider: fos_userbundle
+ csrf_provider: form.csrf_provider
+ logout: true
+ anonymous: true
+ remember_me:
+ key: "%secret%"
+ lifetime: 31536000 # 365 days in seconds
+ path: /
+ domain: ~ # Defaults to the current domain from $_SERVER
access_control:
- #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
- #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
+ - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
+
+ role_hierarchy:
+ ROLE_ADMIN: ROLE_USER
+ ROLE_SUPER_ADMIN: ROLE_ADMIN
View
@@ -17,7 +17,9 @@
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
- "jms/di-extra-bundle": "1.1.*"
+ "jms/di-extra-bundle": "1.1.*",
+
+ "friendsofsymfony/user-bundle": "*"
},
"scripts": {
"post-install-cmd": [
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -5,11 +5,11 @@
<div class="row">
<div class="span12" style="text-align: center;">
- <br><br>
+ <br>
<h1 style="font-size: 70px;">SymfonyBricks</h1>
- <br><br><br><br><br>
+ <br><br><br>
<p style="font-size: 20px;">
Built by the community for the community
@@ -19,6 +19,23 @@
SymfonyBricks aims to be a repository of code, snippets and recipes useful to Symfony developers
</p>
+ <br><br>
+
+ <p>
+ register to <a href="http://symfonybricks.com">symfonybricks.com</a>
+ </p>
+ <p>
+ <a href="{{ path('contribute') }}" class="btn btn-mini"><i class="icon-user"></i> register now</a>
+ <p>
+ <span class="text-small text-italic">
+ Register feature has just been implemented: right now registration is important to know
+ <br>
+ how many interested users in SymfonyBricks there are. Many features will be developed soon,
+ <br>
+ as more and more people will join!
+ </span>
+ </p>
+
<br><br><br><br>
Do you want to know more?
<br><br>
@@ -27,7 +44,7 @@
&nbsp;&nbsp;&nbsp;
<a href="https://github.com/inmarelibero/SymfonyBricks/wiki" target="_new" class="btn btn-large"><i class="icon-book"></i> github wiki</a>
&nbsp;&nbsp;&nbsp;
- <a href="{{ path('contribute') }}" class="btn btn-large"><i class="icon-heart"></i> how to contribute</a>
+ <a href="{{ path('contribute') }}" class="btn btn-large"><i class="icon-hand-right"></i> how to contribute</a>
</div>
</div>
@@ -59,7 +76,7 @@
<div class="row">
<div class="span12">
- <h3>I want to contribute</h3>
+ <h3>Get involved</h3>
The first important thing you can do is to use Twitter to stay tuned with the latest updates and to spread SymfonyBricks.
</div>
</div>
@@ -73,15 +90,15 @@
</div>
<div class="span6">
<p class="text-italic text-small">
- Share the link to <a href="http://symfonybricks.com" target="_new">symfonybricks.com</a>
+ Share the link <a href="http://symfonybricks.com">symfonybricks.com</a>
</p>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://symfonybricks.com/" data-via="SymfonyBricks">Tweet</a>
</div>
</div>
<br><br><br>
<div class="row">
<div class="span12">
- The next step is to have a look at <a href="{{ path('contribute') }}">this section</a> for more detailed informations.
+ The next step is to have a look at <a href="{{ path('contribute') }}">the section "Contribute"</a> for more detailed informations.
</div>
</div>
Oops, something went wrong.

0 comments on commit 210157f

Please sign in to comment.