Problem/Motivation
When multiple files in a directory use the protected pages password, the user must re-enter the password for every page they want to access. It would be a better user experience if they only had to enter the password once.
Proposed resolution
Add a new option "validate per section" which would remember if the user has entered a valid password already and not require it for all pages in the section.
User interface changes
A new admin option is added. See https://www.drupal.org/files/issues/2023-04-19/validate_per_section_chec...
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | validate_per_section_checkbox.png | 218.74 KB | mmatsoo |
| #29 | protected_pages-2239433-d8-29.patch | 9.52 KB | douggreen |
| #9 | protected_pages-root-2239433-9.patch | 739 bytes | brad.bulger |
Issue fork protected_pages-2239433
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
mouse70 commentedanyone?
Comment #2
colanI think the global password is one for all pages on the site so there doesn't appear to be a way to group them (other than all pages).
I'm sure the maintainer would accept patches for this one.
Normally I'd set the Version to HEAD as that's where all new features go (e.g. 7.x-2.x), but this project doesn't seem to be configured that way.
Comment #3
varunmishra2006 commentedThe module is not designed to work in this way but I can consider this case in next release.
Comment #4
brightboldThis would be a great feature. In #2122365: One password, multiple nodes you state that this isn't necessary because it can be done by creating a role with proper permissions. My client would like a simple password protection system that will allow anonymous users the ability to access certain content if they have the appropriate password and this could be much more easily done with your module than with roles & permissions.
To do this in D7 without Protected Pages, I'd have to:
If this module allowed wildcard paths to be protected, that would reduce the steps to:
protected-area/*)Unfortunately I don't have the back-end skills to write a patch for this, but if someone did it I think it would be a valuable addition to this project.
Comment #5
falc0 commented+1 for this feature
Comment #6
andyanderso commented+1 more for this feature
Comment #7
Tmod700 commented+1 another for this feature, Would be a great addition to a already good module.
Comment #8
gaiello commented+1 for this feature. I particularly favor allowing the protected path to include a wildcard.
Comment #9
brad.bulger commentedthis is something like what's discussed here. it's not full wildcard support because that would mean removing or changing the path validation. this is the minimum change i could make that would do what i needed.
it adds the ability to set a password on a root. you add a "/" to the end of the path for the password - "a/b/" for instance. then any access to "a/b", "a/b/c", "a/b/c/d", etc. requires that password. and having supplied it once, it's valid for the root and all of its children.
all i did was add a
where()condition to the query that does a LIKE match to the current path.Comment #10
tormu commentedTried the patch, but the admin section doesn't allow / to be added at the end of paths. If you enter "test-path/" as the path, there's an error Please enter a correct path!
Comment #11
brad.bulger commentedi'm using 2.4 and if "test-path" is a valid path on its own, then "test-path/" is accepted as well.
Comment #12
tormu commentedI'm using 7.x-2.4 too. Haven't tried making a view or a custom menu hook that would create a path, but at least nodes with path aliases this doesn't seem to work. I was hoping to create a node with "test-path" alias and additional nodes with "test-path/subnode" and so on under it using pathauto patterns but to no avail.
Comment #13
brad.bulger commentedAh I was using an actual path not an alias.
Comment #14
brad.bulger commentedI added code to handle the trailing slash in validation.
Comment #15
tormu commentedGreat job brad.bulger, the #14 patch works for me - I'm able to create a protected page with relative path "test-path/" and all nodes that are under that (for example "test-path/sub-path") are protected too. Typing the password once allows access to all pages below, so this one is good to go for my purposes :)
Comment #16
colanComment #17
FinderFees commentedI just applied the patch in #14 yesterday and it works great for me! Thank you so much! I was lost because I couldn't find a way to do this with apache, and I really needed to secure a section of the site vs just a page.
Comment #18
Tmod700 commentedHad a little hiccup as I had to apply the patch manually but got it done and works well.
Thanks Brad!!
Comment #19
WorldFallz commentedPatch in 14 applies cleanly and works great.
Comment #20
stoob commentedI've tested the patch in #14 and indeed it does work, I suggest it be included in the next release, however I am curious why format such as
isn't supported, as this is the method for Block Visibility and other Drupal features.
Comment #21
P3ns4 commentedHi guys , i'm new on drupal, i need to update this module, but when i add this lines of code my site crash. I know that is a newbie question, but how can i add this patch?
Comment #22
cabplan commentedPatch in 14 applies cleanly and works great.
Comment #23
timmerk commentedPatch 14 applied cleanly to the latest stable (2014) Drupal 7 version, but doesn't work in practice for me. It lets me enter "the-path/" (with the trailing slash), but doesn't prompt for a password on any child paths, such as "the-path/welcome". The children nodes are using Pathauto to automatically generate their URLs. Any ideas? Thanks!
Comment #24
MattHalo commentedIncluded a patch which adds a config setting to enable access to all protected pages with a single password.
Comment #25
chris matthews commentedComment #26
anschultz commentedI just tested the patch in #14 against Protected Pages 7.x-2.4 on 2021-03. The patch applied cleanly, but had mixed results with 'working'.
The patch does work to password-protect all pages under a URL. I needed to add a slash at the end of the URL in the Protected Pages UI config form for this to work. Every page that contained the original URL was password-protected same as the parent page. So my-url/ and my-url/one are both protected when I create a password just for my-url/
The patch does not work allow access to all child pages after authenticating on the parent page. I still needed to authenticate on child pages. However, this behavior seemed inconsistent, and possibly based on browser (does not work in Chrome). Testing was confusing, but in the end, failed more often than not.
Comment #27
douggreen commentedAttached patch is a slightly different re-imaging and re-implementation of this idea, for d8.
What this does:
A few notes on the implementation:
Comment #28
douggreen commentedMarking as "needs review" for the d8 version.
Comment #29
douggreen commentedRe-rolled
Comment #30
markdorisonDoes the title of this issue still adequately describe it? Also, there is no issue summary. It would be really helpful when reviewing to understand what is being proposed.
Comment #31
mmatsoo commentedThe patch from #29, https://www.drupal.org/files/issues/2023-03-21/protected_pages-2239433-d..., successfully applied to the 8.x-1.6 version of protected_pages.
Here is a screenshot of the Validate per section checkbox in action.
My testing has been successful, in that I could access multiple password-protected pages by entering a password once. (Without the patch, the module expects you to enter a password for each protected page you visit.)
Comment #32
douggreen commentedProblem/Motivation
When multiple files in a directory use the protected pages password, the user must re-enter the password for every page they want to access. It would be a better user experience if they only had to enter the password once.
Proposed resolution
Add a new option "validate per section" which would remember if the user has entered a valid password already and not require it for all pages in the section.
User interface changes
A new admin option is added. See https://www.drupal.org/files/issues/2023-04-19/validate_per_section_chec...
Comment #33
douggreen commentedOops, that last comment was meant to update the issue summary.
Comment #34
glynster commented+1 RTBC this patch works well and helps with the end user having to input multiple passwords.
Comment #35
douggreen commentedIs this different than #3024997: Global password is requested multiple times for every protected page?