The problem is in nodeaccess_password_403()

...
if (arg(0, $path) != 'node' || !is_numeric(arg(1, $path))) {
      $path = drupal_lookup_path('source', $path);
    }
    if (arg(0, $path) == 'node' && is_numeric(arg(1, $path))) {
...

I think drupal_lookup_path() needs to get propper language code and 'node' (in second if statement) is not fisrt argument on multilangual sites.

New options in $path are e.g.:

  1. /en/aliased/path
  2. /en/node/[nid]
  3. /cs/aliased/path
  4. /cs/node/[nid]

Comments

jiri.dzuba’s picture

Assigned: Unassigned » jiri.dzuba
StatusFileSize
new636 bytes

Patch for nodeaccess_password.403.inc. Rewriting a condition for checking prefix multilangual sites.

radimklaska’s picture

Assigned: jiri.dzuba » Unassigned
Status: Active » Needs review

I tested the patch in #1 and it looks OK to me. But @jiri.dzuba is my coworker, so I'm kind of biased. :)

PS: @jiri.dzuba Congrats to first post and first patch on d.o! :)

radimklaska’s picture

Status: Needs review » Needs work

I took a second look and found some space to improve the patch.

1) We should replace str_replace with preg_replace and delete the prefix only if it is at the beginning of an URL.

2) if (module_exists('i18n')) { and i18n_language_context() isn't the best - you can have language prefixed URLs without i18n module. (Rare, but possible.)

radimklaska’s picture

Also we should probably use drupal_get_normal_path() https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_get_... instead of drupal_lookup_path().

Adrenaline-2’s picture

Hi, im not sure if this is the right place to bring up this issue im having...
I made this module work once, and after rebuilding the permissions it stopped working,

-> When an anonymous user tries to get on the basic page i added (with the password), they dont get redirect to the access denied page, instead they end up with a white page.... any idea why this could happen?

radimklaska’s picture

@Adrenaline are you using the patch from #1?

EDIT: Is your site multilingual?