Integrated FOSUserBundle (#216)
This commit is contained in:
@@ -32,4 +32,7 @@ admin_lte:
|
||||
routes:
|
||||
adminlte_profile: user_profile
|
||||
adminlte_welcome: dashboard
|
||||
adminlte_login: security_login
|
||||
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
|
||||
@@ -11,6 +11,9 @@ doctrine:
|
||||
driver: 'pdo_mysql'
|
||||
server_version: '5.7'
|
||||
charset: utf8mb4
|
||||
default_table_options:
|
||||
charset: utf8mb4
|
||||
collate: utf8mb4_unicode_ci
|
||||
|
||||
# With Symfony 3.3, remove the `resolve:` prefix
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
|
||||
25
config/packages/fos_user.yaml
Normal file
25
config/packages/fos_user.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
fos_user:
|
||||
db_driver: orm
|
||||
firewall_name: secured_area
|
||||
user_class: App\Entity\User
|
||||
from_email:
|
||||
address: '%env(MAILER_FROM)%'
|
||||
sender_name: "Kimai 2"
|
||||
registration:
|
||||
confirmation:
|
||||
enabled: false
|
||||
template: '@FOSUser/Registration/email.txt.twig'
|
||||
resetting:
|
||||
retry_ttl: 7200
|
||||
token_ttl: 86400
|
||||
email:
|
||||
template: '@FOSUser/Resetting/email.txt.twig'
|
||||
service:
|
||||
mailer: fos_user.mailer.twig_swift
|
||||
# group:
|
||||
# group_class: ~ # Required when using groups
|
||||
# group_manager: fos_user.group_manager.default
|
||||
# form:
|
||||
# type: FOS\UserBundle\Form\Type\GroupFormType # or 'fos_user_group' on Symfony < 2.8
|
||||
# name: fos_user_group_form
|
||||
# validation_groups: [Registration, Default]
|
||||
@@ -1,4 +1,5 @@
|
||||
kimai:
|
||||
|
||||
# All configs related to timesheet and record management
|
||||
timesheet:
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ security:
|
||||
|
||||
# https://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
|
||||
providers:
|
||||
database_users:
|
||||
entity:
|
||||
class: App\Entity\User
|
||||
fos_userbundle:
|
||||
id: fos_user.user_provider.username_email
|
||||
|
||||
firewalls:
|
||||
dev:
|
||||
@@ -32,18 +31,20 @@ security:
|
||||
# This allows the user to login by submitting a username and password
|
||||
# Reference: http://symfony.com/doc/current/cookbook/security/form_login_setup.html
|
||||
form_login:
|
||||
# fos user bundle handles the form login
|
||||
provider: fos_userbundle
|
||||
# The route name that the login form submits to
|
||||
check_path: security_login
|
||||
check_path: fos_user_security_check
|
||||
# The name of the route where the login form lives
|
||||
# When the user tries to access a protected page, they are redirected here
|
||||
login_path: security_login
|
||||
login_path: fos_user_security_login
|
||||
# Secure the login form against CSRF
|
||||
# Reference: http://symfony.com/doc/current/cookbook/security/csrf_in_login_form.html
|
||||
csrf_token_generator: security.csrf.token_manager
|
||||
|
||||
logout:
|
||||
# The route name the user can go to in order to logout
|
||||
path: security_logout
|
||||
path: fos_user_security_logout
|
||||
# The name of the route to redirect to after logging out
|
||||
target: homepage
|
||||
|
||||
@@ -54,9 +55,9 @@ security:
|
||||
ROLE_SUPER_ADMIN: ROLE_ADMIN
|
||||
|
||||
access_control:
|
||||
# this is a catch-all for the admin area
|
||||
# additional security lives in the controllers
|
||||
- { path: '^/(%app_locales%)$', role: IS_AUTHENTICATED_FULLY }
|
||||
- { path: '^/(%app_locales%)$', role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: '^/(%app_locales%)/login', role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: '^/(%app_locales%)/register', role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: '^/(%app_locales%)/resetting', role: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: '^/(%app_locales%)/admin', roles: ROLE_ADMIN }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user