Symfony tutorial: Registration and Login system with email verification and password reset

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ค. 2024
  • We are going to create a login page that has a link to reset password and a registration page that require a valid email and email confirmation. we will also create a simple page that can be only accessed by logged in users.
    Chapters:
    0:00 Task introduction and requirements
    0:15 Install a Symfony application
    0:48 Install required dependencies with composer
    1:20 Open PhpStrom from Terminal
    1:30 Add database credentials in the .env file of a Symfony application
    1:40 Add email crendentials in the .env file of a Symfony application
    1:57 Create A application User with maker bundle in a Symfony application
    2:07 Create A Login form and a logout link
    2:21 Create A controller with the maker command in a Symfony application
    2:38 Secure A controller in a Symfony application
    3:33 Redirecting logged in user to a different route in a controller
    3:45 Create a registration form in a Symfony application
    4:25 Redirecting registered users from the registration page to the protected controller
    4:58 Adding a link to a route in a twig template
    5:41 Only users that verify their email can see the protected template
    7:12 Creating all database tables using the maker command
    8:39 Add a password reset in a Symfony application
    -------------------------------------------------------------------------
    tools:
    --------
    composer: getcomposer.org/download/
    mailtrap: mailtrap.io/signin
    phpstorm: www.jetbrains.com/phpstorm/
    windows terminal: github.com/microsoft/terminal
    symfony 6: symfony.com/
    mysql: dev.mysql.com/downloads/insta...
    chrome: www.google.com/chrome/
    -------------------------------------------------------------------------
    commands:
    ------------------
    composer create-project symfony/skeleton symfony_login
    cd symfony_login
    composer require twig orm security mailer form validator maker symfonycasts/reset-password-bundle symfonycasts/verify-email-bundle
    php bin/console make:user
    php bin/console make:auth
    php bin/console make:registration-form
    php bin/console make:reset-password
    php bin/console doctrine:schema:create
    symfony serve
    -------------------------------------------------------------------------
    Github Repository:
    -----------------------------
    github.com/Moh-Snoussi/Symfon...

ความคิดเห็น • 17

  • @zenobikraweznick
    @zenobikraweznick ปีที่แล้ว +3

    Just appreciate the fact that he's coding while flying a freaking plane.

  • @Pierre-Yoyo
    @Pierre-Yoyo หลายเดือนก่อน

    Great tutorial! Thank you. Works perfectly in Symfony 6.
    But I'm new to Symfony and would like to start directly in 7, to avoid having to migrate too quickly. But I can't get it to work in Symfony 7. make:auth is deprecated and no longer works in 7 and when I replace it with make:security:form-login it doesn't work either. I've also been unable to upgrade the application to Symfony 7. Is it possible to get a version 7 of this tutorial or some advice on how to update it?

  • @borisloncaric434
    @borisloncaric434 ปีที่แล้ว +1

    Very nice tutorial! Thank you. Please make more Symfony tutorials

    • @code-for-me
      @code-for-me  11 หลายเดือนก่อน

      Thanks, will do!

  • @Sa1991mo
    @Sa1991mo หลายเดือนก่อน

    I always get an error on registration: Warning: Trying to access array offset on value of type null

  • @Autos-kc6qe
    @Autos-kc6qe ปีที่แล้ว +1

    Good Job

  • @hyperannatv3387
    @hyperannatv3387 11 หลายเดือนก่อน

    sir can u create a tutorial on how to install symfony? and create simple app?

  • @code-for-me
    @code-for-me  10 หลายเดือนก่อน

    If the email sending isn't functioning as expected, it could be due to the presence of Symfony Messenger, which can create an email queue to prevent the response from waiting until the email is sent. You have two options to resolve this issue:
    Remove or comment out the following line in your config/packages/messenger.yaml file:
    Symfony\Component\Mailer\Messenger\SendEmailMessage: async
    Alternatively, open terminal and start the Messenger worker by running the following command:
    symfony console messenger:consume async -vv

  • @nidhalcherif8402
    @nidhalcherif8402 ปีที่แล้ว

    I have installed via composer the module "symfony/mailer" and also symfonycasts/verify-email-bundle, but this is not working and i can see any email on my inboxes on mailtrap. can you help me please?
    knowing that I have correctly configured the DSN mailer of *.env as indicated

    • @code-for-me
      @code-for-me  ปีที่แล้ว

      It can be that the email is stuck on the messanger queue system. if you have config/packages/messenger.yaml try commenting the:
      Symfony\Component\Mailer\Messenger\SendEmailMessage: async

    • @pacmaybz
      @pacmaybz ปีที่แล้ว +1

      same problem here. Did you solve it?

    • @user-jf9ro8vc6t
      @user-jf9ro8vc6t 11 หลายเดือนก่อน

      @@pacmaybz Although my file is Symfony\Component\Mailer\Messenger\SendEmailMessage: async, it doesn't work, instead I run php bin/console messenger:consume async.

    • @code-for-me
      @code-for-me  10 หลายเดือนก่อน

      did you try the above "commenting the:
      Symfony\Component\Mailer\Messenger\SendEmailMessage: async" ?

    • @lolikaaa
      @lolikaaa 9 หลายเดือนก่อน

      @@code-for-me
      Edit: problem solved - you need to change one line in reset_password.yaml - there is instruction on that file :)
      I have the same problem and I tried comment this line in my messanger.yaml but still not sending any emails :( Another thing - I dont have any data in my reset_password_request table. But it sends the email after registration but not when we want to reset the password.

  • @futuresuperinfinity3526
    @futuresuperinfinity3526 ปีที่แล้ว

    i want a symphony tutor personal tutor who can teach me only