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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

erikwebb’s picture

Status: Active » Closed (won't fix)

Password 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.

lpalgarvio’s picture

triggering 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)

erikwebb’s picture

I 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.

netw3rker’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Closed (won't fix) » Needs review
FileSize
1.43 KB

Integrating 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.

Status: Needs review » Needs work

The last submitted patch, 4: 1234164-4_integrate-with-entity-rules.patch, failed testing.

netw3rker’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
FileSize
1.33 KB

In 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.

netw3rker’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
FileSize
1.39 KB

Here's a patch for 2.x

AohRveTPV’s picture

#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.