Enforce password change every 90 days (3 months) I am currently building an intranet for a client and one of their requirements is that staff must update their passwords every 90 days. 

I assume I would need to build a plugin for this, but what would be best to way to approach this? I was hoping it might work whereby this was set 90 days after the last password change, rather than a fixed date for every user. 

Thanks
$date90DaysAgo = (new \DateTime())-&gt;modify('90 days ago')-&gt;format('Y-m-d H:i:s');
foreach(\craft\elements\User::find()-&gt;lastPasswordChangeDate('&lt;='.$date90DaysAgo)-&gt;all() as $user){
    Craft::$app-&gt;getUsers()-&gt;sendPasswordResetEmail($user);
    $user-&gt;newPassword = // generate some temp password, so the user can't login with his/her anymore
    $user-&gt;setScenario(User::SCENARIO_PASSWORD);
    Craft::$app-&gt;getElements()-&gt;saveElement($user);
}


get the date 90 days ago, find all users where lastPasswordChangeDate is smaller than this date, send them a new password reset email and change their password to something else, so they can't login anymore.