Skip to content

Conversation

@yceruto
Copy link
Member

@yceruto yceruto commented Jan 16, 2017

This PR change the default target path / to admin_index blog_index route, useful when we access to login page directly (i.e. through URL).

@bocharsky-bw
Copy link
Contributor

Looks like in this case, users, which don't have access to the admin page, will have an "Access denied" error.

@yceruto
Copy link
Member Author

yceruto commented Jan 17, 2017

@bocharsky-bw you're right, but actually already happening, at least the most of times, the users accessing to login page through "browser backend" button and they get a "Access Denied" (and it makes sense if it was your intention).

Something like "redirect to post index for users" or "redirect to admin index for admins" would be the best approach.

Any suggestion to improving it?

@stof
Copy link
Member

stof commented Jan 17, 2017

@yceruto if you want to do it, you need to create a dedicated route (used as target path) for which the controller would do redirections conditionally.

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm divided about this proposal. If we do this right, we must create a listener to redirect to the best page depending on each user ... but that may be a bit overkill for this demo app.

Should we go all in for the listener ... or abandon this idea? Thanks!

@yceruto
Copy link
Member Author

yceruto commented Jan 22, 2017

Something like "redirect to post index for users" or "redirect to admin index for admins" would be the best approach.

I'm agree that @stof's and @javiereguiluz's solution may be a bit overkill for this demo app and I abandon this idea.

But, my initial goal here was to find a better default_target_path that / for "the user" (admin or not) after login "only in this case:"

When the user access to login page directly (i.e. through URL) then this option (default_target_path) is used and not through "Browse Backend" button from home page, which use the target path saved in session.

So, to make it simpler and to avoid "Access denied" for users, I've changed again the default_target_path option to blog_index instead.

What do you think now?

@yceruto yceruto changed the title By default redirect to admin post index page after login By default redirect to post index page after login Jan 22, 2017
Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@javiereguiluz javiereguiluz merged commit 09e2c64 into symfony:master Feb 7, 2017
javiereguiluz added a commit that referenced this pull request Feb 7, 2017
…uto, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

By default redirect to post index page after login

This PR change the default target path `/` to <del>`admin_index`</del> `blog_index` route, useful when we access to login page directly (i.e. through URL).

Commits
-------

09e2c64 Improved the help note
283d838 Expanded the help note about default_target_path
0b753ab By default redirect to post index page after login
@yceruto yceruto deleted the target_path branch February 7, 2017 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants