From a default install of 7.x-dev
Expected:
Login from "http://yoursite.com" redirects to "http://yoursite.com" after login
Login from "http://yoursite.com/node" redirects to "http://yoursite.com/node" after login
Login from "http://yoursite.com/node/1" redirects to "http://yoursite.com/node/1" after login
Actual:
Login from "http://yoursite.com" redirects to "http://yoursite.com/node" after login
Login from "http://yoursite.com/node" redirects to "http://yoursite.com/node" after login
Login from "http://yoursite.com/node/1" redirects to "http://yoursite.com/node/1" after login
Fix:
user.module @ line 1238:
function user_login_block($form) {
-$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
+$form['#action'] = url($_GET['q'], array('query' => (($_SERVER['REQUEST_URI'] == '/') ? array('destination' => '<front>') : drupal_get_destination())));
Comments
Comment #1
mertskeli commentedYes, annoying...
yoursite.com/node is set in admin > config > system > site info, is required, and not clear why.
I even tried to put instead of "node" - kicked the bucket
Comment #2
bleen commentedThis is "as designed" because the user can set what the front page is at admin/config/system/site-information
it happens that the default is /node, but the user could just as easily change the front page to /node/2 or /admin
The login redirect (as well as dozens of instances throughout core and contrib that need to redirect to the front page) works this way so that the "front" setting is properly respected.
Comment #3
mertskeli commentedSorry, but it is bad if is designed like that.
1. Go to Site information
2. Put
<front>instead of "node" (who needs some "node" as the home path?)3. Click "Home" - "Page not found". No menus, no structure - nothing. Just empty page.
Is it ok?
Comment #4
bleen commented<front>is meaningless in the site info form.<front>is a placeholder in other forms for "whatever the user put in the site information form". For example, put this in a tpl.php within your theme to create a link back to the front page (whatever that might be):This link will *always* work even if you change the site info form...
Also, there are *many* sites that use a specific node as the front page (usually a node of type==page).
I'm sorry to keep setting this back to "As designed", but it really is.
Comment #5
mertskeli commentedI am awfully sorry but why a user should hardcode home link if it is already provided by breadcrumbs and site logo/name ?
I still assume that if entering a home page shows example.com/node - it is wrong. There is no such path. It links to nowhere. Front page should have nothing but http://www.example.com. Or at least example.com/index.
Here what happens:
1 - fresh install, site info has "node", then
login - example.com
home link - example.com
2 - site info is blank, then
login - example.com
home link - example.com/node
3 - site info has
<front>WSOD
Also, please try to remove "node" and save the settings. After that you will not be able to set "node" again - it will stay blank all the time. After that you'll always get example.com/node.
Comment #6
bleen commentedmertskeli, you never ever put
<front>in the site info form. Think of<front>as a variable that you can use in forms throughout the Drupal GUI...<front> == 'whatever the user entered in the site info form'So if you enter node, then
<front>= 'node'. If you change the value in that form to be 'node/3' (which I promise is a very common case) then<front>= 'node/3'.If you enter
<front>then you should get unexpected results because you've created a circular reference:<front>=<front>=<front>=<front>.... Actually *this* might be a bug - we should not allow a user to enter<front>in this formIf you remove 'node' from that form then (I think) drupal *should* show a content feed. But leaving the site info form item blank is a *very* uncommon case.
Feel free to keep asking questions about this, but please do not change this back to active until you completely understand what
<front>really means and why /node is -in fact- the correct behavior and at that point can articulate a bugComment #7
mertskeli commentedOk, I should not put
<front>because Drupal will crash...I should not make it blank because Drupal will crash...
It is not a form. Although it looks like a form...
And it is *very* uncommon to have the home path without "node". Moreover, core Path module should be eliminated cause it is for uncommon people who do not get it...
But it is not a bug! It's the correct behavior with good intentions :))
bleen18, I kindly ask you not to close the issue if you can not help to solve it. It is not critical and will not delay the release.
Comment #8
bleen commentedThis IMO is a bug
This does not cause an error. I just tested on two different d7 installs. I get a page with the same content as /node, presumably this is the fallback. You are getting a WSOD here? An error?
Yes, it is a form. I dont know what makes you think it isn't. All *other* forms in drupal that expect a path can accept
<front>which serves (essentially) as a placeholder for wahtever the site administrator has entered in *this* formThis is not uncommon at all. However, drupal expects *something* to be the frontpage of the site so that it knows what content to render. The default *something* is "/node" which is a list of all nodes (as teasers) but it is just as valid to make "/admin" or "/user" or "/node/123" the front page.
Each of my comments are simple fact about how drupal renders the front page and they are "by design". There are plenty of issues out there that deal with changing what Drupal chooses to display as the frontpage (though many revolve around the initial install) so maybe a look through some of these issues will help:
#126221: Make 'node' empty text themable.
#475596: [meta-issue] Fix the unholy abomination that is the welcome screen
#419950: Remove /node as default front page
#423724: Help landing page: what should be on it, how would it look.
Comment #9
mertskeli commented<front>causes "page not found", not "node". I called it wsod because there is nothing in the screen after that except "Skip to main content" (which is generated by html.tpl, I suppose; $page produces no output).Being trained by all the other forms, the desire to put
<front>for the front page seems to be logical.Here we speak about 2 issues: 1 - it is strange to have example.com/node as the home path, 2 - site info "front page" field is buggy and even dangerous.
If drupal expects *something* to be the frontpage (and we all do) it does not mean that this *something* should be some scary unexistent "node". Note, I'm not talking about node system here, or how Drupal works. Just about the browser address, which is still the most reliable navigation for a site visitor. Example.com/node for an empty front page is really misleading.
Ok, I see. Better to close this issue. If nobody complains it will stay "as designed", and the disagreed persons will have to find the solution themselves. Otherwise it will be fixed.
Comment #10
mustanggb commentedThis has nothing to do with setting "Default front page"
Only that the login block doesn't redirect to when you login from
Instead it resolves to a path and takes you there instead
This looks messy, hence the issue
@mertskeli
I have no idea what you are getting at
OFC you need to specify a path for "Default front page"
Otherwise what would be displayed?
Comment #11
bleen commentedEDIT: ignore this
Comment #12
mustanggb commented@bleen18
Could you explain why you think the destination not getting set to the preceding url is acceptable?
Comment #13
bleen commentedI'm going to bow out of this issue ... if someone wants to propose some new way of handling
in this situation thats fine .. but I contend that this works exactly as designed.
Comment #14
ksenzeeClosing this as a duplicate of #949230: Forms in blocks on the front page that have no explicit destination should end up at / and not /node . This is the older issue, but that one has a patch.
Comment #15
joegl commentedThis is still happening. Not sure if I add another
Related: https://www.drupal.org/forum/support/post-installation/2006-05-22/login-...
The "duplicate" issue does not have a relevant patch for the current version of Drupal 7 to fix the issue. All the code has changed.
Comment #16
mustanggb commentedClosing as a duplicate again, at least until it's fixed in D8.