Reference repository: https://github.com/sumocoders/Framework-User-Implementation-Example.git
All commands and paths in these steps assume the current working directory is the project root.
- Execute all steps in order - Do not skip, reorder, or add steps - Only copy the files explicitly listed. Do not copy anything else from ./temp 1. From the project root, clone the reference repository: `git clone https://github.com/sumocoders/Framework-User-Implementation-Example.git ./temp`-
Install packages:
symfony composer require 2fa scheb/2fa-backup-code scheb/2fa-totp scheb/2fa-trusted-device endroid/qr-code- If
Scheb\TwoFactorBundle\SchebTwoFactorBundle::classis missing fromconfig/bundles.php, add it:Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true]
- If
-
Copy from
./tempinto the project, preserving paths:config/packages/scheb_2fa.yamlconfig/routes/scheb_2fa.yaml
-
In
config/packages/security.yaml, add inside the firewall definition:
two_factor:
auth_form_path: 2fa_login
check_path: 2fa_login_check
trusted_parameter_name: _trustedAdd to access_control:
- { route: '2fa_login', roles: IS_AUTHENTICATED_2FA_IN_PROGRESS }
- { route: '2fa_login_check', roles: IS_AUTHENTICATED_2FA_IN_PROGRESS }
- { route: 'user_2fa', roles: ROLE_USER }
- { route: 'user_2fa_qrcode', roles: ROLE_USER }
- { route: 'user_password', roles: ROLE_USER }
- { route: 'user_profile', roles: ROLE_USER }-
Copy from
./temp, preserving directory structure:src/Command/Usersrc/Controller/Usersrc/DataTransferObject/Usersrc/Entity/Usersrc/Exception/Usersrc/Form/Usersrc/Message/Usersrc/MessageHandler/Usersrc/Repository/Usersrc/Validator/Usersrc/ValueObject/Usersrc/Securitytemplates/usertests/Entity/Usertests/MessageHandler/Usertests/Repository/Usertests/Validator/Usertests/ValueObject/User
-
Copy
src/EventListenerfrom./tempinto the project'ssrc/directory. -
Copy all files from
./temp/src/Migrations/intosrc/Migrations/, then run:symfony console doctrine:migrations:migrate -
From the project root, remove the temp folder:
rm -rf ./temp -
Ask the user which optional features to remove, then apply:
- No profile page: remove
src/Controller/User/ProfileController.php,templates/user/profile.html.twig, and the profile navigation entry intemplates/user/_profile_navigation.html.twig - No registration: remove
src/Controller/User/RegisterController.php,src/Message/User/RegisterUser.php,src/MessageHandler/User/RegisterUserHandler.php,templates/user/register.html.twig
- No profile page: remove