R
R
Rodion Yurchenko2017-03-03 18:12:59
symfony
Rodion Yurchenko, 2017-03-03 18:12:59

How to make a login form before logging into a site in Symfony 3?

Good afternoon!
Regarding the question, I think it’s clear that I’m just starting to study Symphony
Sobsno the question is in the title (that is, the site is completely closed without authorization)
I use FOSUserBundle
Now my login form works like this: I check in each of my controllers in the constructor whether the user is logged in or not?
If not logged in, then a forced redirect to the login form
. But it seems to me that this is a bicycle ....
Is there any more elegant solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2017-03-03
@aassdds

symfony.com/doc/current/security.html#add-code-to-...

access_control:
    - { path: ^/, role: IS_AUTHENTICATED_REMEMBERED }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question