-
Notifications
You must be signed in to change notification settings - Fork 7
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
No exception handling for routes when sessions are nullified or inactive #11
Comments
Hi @crim3hound , that happens because there is no authenticated user. In the first screenshot, you'll see a user icon next to which it says "anon" -> that means, in Symfony terms, an anonymously authenticated user, i.e. no user. You can handle 403 exceptions within Bolt itself, by configuring a 403 page. You can check the |
There may well be a better ways to handle this for people who were already logged in -> maybe by setting some session that we can check in this repo somewhere? I'm open to any ideas! |
Thanks, @I-Valchev. I'll check it out in more detail and get back to you! At the moment I have opted for redirection as opposed to using the 403 handler for my use case. Trying to keep front-end users as far as possible from anything that may point them to the backend. Just customising the extension from a security by obscurity perspective. What do you think? Same thing applies to the logout route, where I'm looking to not let users see the |
I think that makes sense too :-) Perhaps allow people to configure where to go to on logout, with default to |
Exactly @I-Valchev! That would probably be better and would allow a more granular config without touching core files. For now in my case, I have set my logout listener in
This way, and together with the exception handling for users accessing profiles, I am able to render to front-end login page. While I wouldn't prefer this method, it's of little consequence at this time if admin users are also redirected to the same screen on logout. Would there be a quick way to maybe add a |
hi @crim3hound, sorry I thought I had replied to this! Glad that it works for you thus far, thanks a lot for the nice work and PRs! I think it does make sense to add a Do you think you can do that in a PR? |
You're welcome, @I-Valchev! Let me look into the logout bit. |
Trying to retrieve the ContentType slug using
$contentTypeSlug = $this->getExtension()->getExtConfig('contenttype', $user->getRoles()[0]);
inFrontendUsersProfileController.php
throws the exceptionCall to a member function getRoles() on null
.This happens when a user tries to access profile routes without an active session, either because it expired or was invalidated.
I have found a solution for this issue and will share for review.
The text was updated successfully, but these errors were encountered: