To replicate this issue:
- set the permissions for the user module's "access user profiles" to be accessible to admins, only
- log in as a non-admin user and set that user's profile to allow their "Personal contact form"
- as that same non-admin user, post a comment to a forum, blog, whatever—i.e., ensure that there's a "contact the author" link available
- log out and log in as a different non-admin user
- use the aforementioned "contact the author" link to access that user's "Personal contact form" and send that user a message
- observe that, when the message has been sent, you are sent to that user's profile page (i.e., the user whose "Personal contact form" you'd just used) but, since you don't have access that user's profile page, you receive a "whatever the site's configured to do with access-denied errors" page
It appears that, in contact.pages.inc
// Back to the requested users profile page.
$form_state['redirect'] = "user/$account->uid";
should first employ a permissions check and, if the target user's profile page is not accessible, use an alternate/accessible redirect.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff-299216-8-10.txt | 592 bytes | jacob.embree |
| #10 | contact-redirect-access-denied-299216-10-D7.patch | 1.88 KB | jacob.embree |
| #8 | contact-redirect-access-denied-299216-8-D7.patch | 1.83 KB | jacob.embree |
Comments
Comment #1
dave reidWill be fixed with #58224: Allow anonymous users access to a members personal contact form
Comment #2
dave reidActually, I think I prefer to fix this separately. Assigning myself and marking back to active.
Comment #3
dave reidPatch attached for review, including tests!
Comment #4
dave reidFor users without access user profiles permission, this should really redirect back to the homepage instead of staying on the contact form. This is what the site-wide contact form does in order to prevent confusion if the sent e-mail triggers flood control on the contact form. Will re-roll tomorrow.
Comment #5
dave reidRevised patch that uses:
Comment #7
dave reidThe fix part of this landed as a part of #601250: Allow anonymous users to use personal contact forms but should still have some tests written for it.
Comment #8
jacob.embree commentedHere's a reroll of the test.
Comment #10
jacob.embree commented