简体   繁体   English

如何定期为用户生成新密码并通知用户新密码?

[英]How to generate a new password for users periodically and notify user of new password?

I am running a private Drupal 7 site where all user accounts are created by admins and managers. 我正在运行一个私有的Drupal 7网站,所有用户帐户均由管理员和经理创建。 I need to ensure that all users have access to the email account that their accounts were created with. 我需要确保所有用户都有权访问与其创建帐户的电子邮件帐户。

What is the best way to do the following: 什么是执行以下操作的最佳方法:

  • Create a user account with an automatically generated password, and notify the new user of their password via email. 使用自动生成的密码创建一个用户帐户,然后通过电子邮件将其密码通知新用户。
  • After a 4 week period, a new password must be generated for the user and set as their active password automatically. 4周后,必须为用户生成一个新密码,并自动将其设置为活动密码。 The user needs to be notified of their newly updated password via email, and the newly generated password must be used to access the site until it is reset again. 需要通过电子邮件将新近更新的密码通知用户,并且必须使用新生成的密码来访问该网站,直到再次重置为止。

Are there any Drupal 7 modules that can help achieve this? 是否有任何Drupal 7模块可以帮助实现这一目标? Any suggestions on building a custom module that can help resolve this? 关于构建可帮助解决此问题的自定义模块的任何建议?

You can use the Mass Password Reset module, read the module description: 您可以使用“ 批量密码重置”模块,阅读该模块的说明:

This module allows users with "Administer users" permission to reset all user accounts and notify all users 该模块允许具有“管理用户”权限的用户重置所有用户帐户并通知所有用户

Details 细节

The module will reset the passwords of all users except the administrative superuser id 1. You can optionally reset the administrative superuser id 1. Once passwords have been reset, users will optionally receive emails using the Drupal password recovery email. 该模块将重置除管理超级用户ID 1之外的所有用户的密码。您可以选择重置管理超级用户ID1。重置密码后,用户可以选择使用Drupal密码恢复电子邮件接收电子邮件。 The password recovery email content can be edited at the account settings configuration page. 可以在帐户设置配置页面上编辑密码恢复电子邮件的内容。

Use cases 用例

You have a large number of user accounts pre-created and want to send password recovery emails to all users during a site launch. 您已经预先创建了大量用户帐户,并希望在网站启动期间向所有用户发送密码恢复电子邮件。 You need to quickly change all passwords on a site for security reasons. 出于安全原因,您需要快速更改站点上的所有密码。

And you can use the Force Password Change module too: 您也可以使用“ 强制密码更改”模块:

This module allows administrators to force users, by role, individual user, or newly created user, to change their password on their next page load or login, and/or expire their passwords after a period of time. 此模块允许管理员按角色,单个用户或新创建的用户强制用户在其下一页加载或登录时更改其密码,和/或在一段时间后使密码过期。

As Patrick W says: You can use the Generate Password module: 正如Patrick W所说:您可以使用Generate Password模块:

Great utility module which makes the password field optional (or hidden) on the add new user page (admin & registration). 很棒的实用程序模块,它使密码字段在添加新用户页面(管理员和注册)上是可选的(或隐藏的)。 If the password field is not set during registration, the system will generate a password. 如果在注册过程中未设置密码字段,系统将生成一个密码。 You can optionally display this password at the time it's created. 您可以选择在创建密码时显示该密码。

Reference: 参考:

https://drupal.stackexchange.com/q/187633/28275 https://drupal.stackexchange.com/q/187633/28275

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM