How do I force all users to reset their pass­word in Craft CMS?

Craft gives us the option to force any particular user to reset their password the next time they login. If you ever need to to force all users to reset their password on a larger site where manually updating each user is not feasible, you might have to do so at the database level.

To force all users to update their password the next time they login, you'll need to set the passwordResetRequired field for each user to true. You can do so with a query like the following:

UPDATE craft_users
SET passwordResetRequired = 1;

If you only want to force admin users to reset their password, you can limit your query to only affect admin users:

UPDATE craft_users
SET passwordResetRequired = 1
WHERE admin = 1;

Please be careful when performing updates directly to the database. Some databases may be configured differently and have a different prefix, and in general you should test anything you do on a development database before doing it to the live site.

Level up in Craft CMS with practical examples, snippets, and patterns.
Craft The Planet emails are sent out several times a week.