New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable login and register page #889
Comments
after three days of search i finally found the way to do it !!! In the FOS securityController (for login) : add this to login action if($session->get("_security_main"))
and it's ok ! |
You should really have a look there: I advice you to use the firewall for exemple my config: security: full security params: |
@mylen it does not solve his problem, as every user has the role IS_AUTHENTICATED_ANONYMOUSLY, even the authenticated ones. |
Well... i'm using that method in my app and it's working as expected maybe
|
should be this a configurable option of the bundle? what do people think? I know i always do that myself too. |
@tannana86 You should use this code. public function registerAction()
{
if ($this->container->get('security.context')->isGranted('ROLE_USER')) {
return new RedirectResponse('/some-page');
}
} |
@tannana86 I don't think you need an option or anything for that as it depends on your application. If you simply don't want to display the login/register form just use in your twig file
If you strickly don't want your user to access /login or /register page, maybe you should simply implement an EventListener that hooks FOSUserEvents on login/registration and do a redirection, it's quite easy if you follow the doc |
@dupuchba Could you expand on how you would use an EventListener for this task? I went through the docs as well as the |
@dupuchba I managed to do this for the registration page using the |
Hello,
Im trying to disable login and register pages for authentified user.
This is the process :
Can someone help me please ?
The text was updated successfully, but these errors were encountered: