I'm trying to add a path to redirect users with specific roles to a destination, but this destination is a destination that ADMIN is not allowed to go to. I'm getting the error message back "Incorrect path, Please Enter valid Path". It seems to me the module would do better to check if the specified roles have been selecte in the form to go to the destination path, rather than just if ADMIN can go to it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DarrellDuane’s picture

Issue summary: View changes
joelpittet’s picture

Status: Needs work » Active

There is no patch here so this is just "active" status. But I get this as well.

joelpittet’s picture

Status: Active » Needs review
FileSize
833 bytes

Because that isn't a valid path... maybe this will do the trick.

DarrellDuane’s picture

Status: Needs review » Needs work

I believe there's more to this issue than just stopping this check if the path isn't ''. I'm not sure what '' means, but I do think its important to check the path as the code currently does, it just needs to check the path as a function of the roles that are selected for this redirect. Doing that will take some coding, I may be up for writing the code someday, perhaps someone else can do it sooner than I can.

Thanks for submitting a patch so that I can make the status "Needs work"!

joelpittet’s picture

If you want to make this more complicated than it is you have to create a pseudo menu link to like the way that <front> is created in core, or use some third party module like menu_token...

Did you test the patch to determine it needs work?

joelpittet’s picture

To be more specific you need to define a menu route in the menu_router table, likely have it callback to a 404 like <nolink> or <separator> are done for special_menu_items module, which is done through the menu_links table.

joelpittet’s picture

I think it's overkill because it's used as a placeholder not an actual menu item, that's why I went with the easier approach here.

perennial.sky’s picture

Category: Bug report » Task
Status: Needs work » Needs review
FileSize
1.2 KB

Hi DarrellDuane,

Adding patch that may solve your problem
but i don't think it is bug according to drupal, administration can access all pages

joelpittet’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Looks like some upstream changes are requiring this to be re-rolled.

perennial.sky’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.35 KB

Here is the rerolled patch.

joelpittet’s picture

+++ b/login_destination.admin.inc
@@ -504,13 +504,36 @@ function login_destination_edit_form_validate($form, &$form_state) {
+    if (!url_is_external($destination)) {
+      if (!_login_destination_path_exist($destination)) {
...
+      }
     }

Any thoughts on using && instead of nesting the checks?

ddrozdik’s picture

Status: Needs review » Needs work

Hey guys,
Good Idea, but I suppose we should to do more flexible validation, and we should check, that role selected in the rule, has access to entered path. Provided patch does not check this, and exist situation that after login/logout user will be redirected to a page with forbidden access for that role.

ddrozdik’s picture

Assigned: Unassigned » ddrozdik
Status: Needs work » Needs review
FileSize
1.87 KB

I have prepared a patch, with validation by role. This patch validates entered path by selected role. If role does not have access to a path, then validation function return an error.

rsvelko’s picture

@DmitryDrozdik requested that I reroll the last patch to fix the english language in the msgs.
Here is a new version with no code logic changes from #13, just language.

I attach a word diff screenshot so we see what I changed (new words are in green).

afi13’s picture

Status: Needs review » Reviewed & tested by the community

Looks good for me.

  • DmitryDrozdik committed 056fd7e on 7.x-1.x
    Issue #2424601 by akashjain132, rsvelko, joelpittet, DmitryDrozdik:...
ddrozdik’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

njogz’s picture

I was still getting this error for valid aliased paths so added $destination = drupal_get_normal_path($destination); above
$item = menu_get_item($destination); which is on line 526. Seems to have sorted it out.

bill_redman’s picture

I am having the same issue of "Incorrect path. Please enter a valid path" even after installing 7.x-1.x-dev. I then tried what njogz did in #19 and the error then changed to Role "role name" does not have access to the path. In the first case, the path is, in fact, a valid path and in the second case, the Role does, in fact have access to the path.

Suggestions anyone?

Thanks.

ddrozdik’s picture

Status: Closed (fixed) » Needs work

@njogz and @Bill Redman please provide examples of configuration that I could reproduce this bug. I need information about used roles, used paths, and other list of settings.

njogz’s picture

Status: Needs work » Closed (fixed)
FileSize
64.45 KB
46.15 KB

@ddrozdik I just tried the module on a clean install of Drupal 7.41 and got the error. The path I am redirecting to is a basic page with the URL alias set. See screenshots for settings.
Login Destination Admin Screenshot
Login Destination Admin Screenshot2

njogz’s picture

@Bill Brendan I also got the same error and still looking into it. Commenting out the foreach loop on line 537-545 removes the error and the redirection works. This probably creates a security vulnerability so maybe someone can suggest an alternative?

ddrozdik’s picture

Status: Closed (fixed) » Needs work

@njogz do not need close ticket if you still have a problem.

I will review this bug today, and will prepare a patch if it will work, we will add it to the module.

As I understood you set an alias as destination path in your example, am I right?

ddrozdik’s picture

Priority: Normal » Critical
Status: Needs work » Needs review
FileSize
1.99 KB

@njogz and @Bill Redman, I have found a problem in the previous patch. I have added needed changes. Please apply this patch and check it.

bill_redman’s picture

@ddrozdik, sorry for not responding to your earlier request. Fortunately, @njogz did. Anyway, your modified patch has solved the problem. I was able to add my new rule successfully. Thank you.

ddrozdik’s picture

Status: Needs review » Reviewed & tested by the community

  • ddrozdik committed d0d3f44 on 7.x-1.x
    Issue #2424601 by ddrozdik: Getting "Incorrect path, Please Enter valid...
ddrozdik’s picture

Status: Reviewed & tested by the community » Fixed

Patch has been committed. Thanks guys.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.