Currently it is possible for users who's password is protected to request a new password, which will reset their password.

I've attached a patch for the 6.14 that does the following things:

- Added code to (optionally) validate the user_pass ("Request New Password") form. If the user is question is protected form editing their password, then the request is rejected, and the user sees an error message directing them to contact the administrator.

- Added a "Configration" tab that currently only contains two items: a checkbox to enable or disable validation of the user_pass form, and a textfield to allow the administrator to specify the URL to use when telling the user to contact the site administrator.

I see in some of the other comments that you're not adding new features in the D6 stream. Hopefully if you do release any bug fixes, you'll change your mind and include this. If there are things you'd like to change about it before including it, let me know - I'm happy to spend a bit more time tweaking it. As for D7, I'm not sure how helpful this will be, but I'd love to see this feature in D7 also.

Thanks for a great module!

CommentFileSizeAuthor
#6 userprotect.2nd.patch1.5 KBasacamano
userprotect.patch7.88 KBasacamano
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hunmonk’s picture

this patch is way overkill IMO. i would accept a much simpler version that simply blocked a user from being able to access the 'user/password' path if they don't have the 'change own password' permission.

hunmonk’s picture

Status: Active » Needs work
asacamano’s picture

Thanks for the feedback. Unless I'm missing something, I don't think that would work: the user isn't logged in when they access user/password, so we can't check for the 'change own password' permission. Am I missing something simple, though?

asacamano’s picture

Oh course, the patch could be a lot simpler without the checkbox and the setting tab. I just didn't want to make everyone else take that functionality. But if it seems like a good idea to you - then I would be happy to just make it the default behavior when the password is protected, and yank the tab and configuration.

hunmonk’s picture

yes, you're right in #3. my logic requires a small adjustment ;)

not too much though. you would let them hit the password form, and hook_form_alter() in a validation function -- from there you should be able to load their user account, inspect their permissions, and return drupal_access_denied() as appropriate.

yes, it should be the default behavior when the password is protected via the absence of the 'change own password' permission. we already specifically know that the user shouldn't be able to edit their own password -- it's sensible to think that they shouldn't be able to, well, edit it by requesting a new one... ;)

asacamano’s picture

FileSize
1.5 KB

Sounds good. Here's a revised patch with all of the extra junk removed.

hunmonk’s picture

we're getting there. couple of things:

a) drupal coding standard for indentation is two spaces -- looks like there are some tabs in there.
b) forgot to mention this before, but we'll need this same patch rolled for the 7.x branch.

i think once those two things are done, plus a quick functionality test on my end, we can get this committed.

asacamano’s picture

But I like tabs! (Just kidding...)

I think I'll be able to get the time to look at 7.x this weekend. More soon...

asacamano’s picture

Just a ping to say this is still on my to-do list, just got slammed by other things.

intyms’s picture

subscribing

dddave’s picture

asacamano is MIA since january. Hope he is doing well. As I am no coder I cannot roll a new patch but I encourage anyone who can to provide this feature. I would definitely like it very much.

hunmonk’s picture

Version: 6.x-1.4 » 7.x-1.x-dev

see http://drupal.org/project/userprotect#commitment for how feature requests are handled