Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hey
integrate with Rules =)
then we can have Rules call actions, like send email, block, make a watchdog entry, unpublish content, etc...
see #833188: Integrate functionality of defunct Password Expire module
Comment | File | Size | Author |
---|---|---|---|
#7 | 1234164-6_integrate-with-entity-rules_2x.patch | 1.39 KB | netw3rker |
#6 | 1234164-5_integrate-with-entity-rules.patch | 1.33 KB | netw3rker |
Comments
Comment #1
erikwebb CreditAttribution: erikwebb commentedPassword Policy 6.x-1.x is feature-frozen.
How would you even see Password Policy integrating? It only reacts to a password changes. It doesn't trigger any events that Rules could integrate with. You could use Rules to already define a Rule where an action can occur when a user is saved.
Comment #2
lpalgarvio CreditAttribution: lpalgarvio commentedtriggering actions when a password is changed could be useful in certain scenarios.
from the top of my mind,
- SMS
- mail
- alert admins when passwords are changed for specific accounts (admins)
it's all about flexibility. custom code replaced with powerful modules (Rules)
Comment #3
erikwebb CreditAttribution: erikwebb commentedI agree it's a worthwhile addition, but until a new branch is undertaken I don't think it belongs in the old code in 6.x-1.x.
Comment #4
netw3rker CreditAttribution: netw3rker commentedIntegrating specifically with rules is probably not the right way to go, but by integrating with the Entity API instead, rules benefits as well. That way this field is available for more modules than just rules.
My specific use case is: "an admin wants to send a one time login, and force a password change after use."
this should be solvable with a component rule that first sets the "must change password" bit for the user, then sends the "reset password" email to the designated user.
The patch below applies the reset_password field to the user object.
Comment #6
netw3rker CreditAttribution: netw3rker commentedIn the previous patch I was directly setting the table value, which was fine except for the fact that after all the actions of rules took place, an entity_save takes place and the force_change flag was being reset back to it's default value. Turns out the setter callback can just modify the user object directly before a save, allowing for thing to function normally.
Here's the updated patch for that. Also this patch was generated for the 1.x line. I'll update it for 2.x in my next post.
Comment #7
netw3rker CreditAttribution: netw3rker commentedHere's a patch for 2.x
Comment #8
AohRveTPV CreditAttribution: AohRveTPV commented#7 does not comply with coding standards. Will try to create new, compliant patch later, but you're welcome to do so.
Thanks for the patches.