保护通过电子邮件发送给用户的临时密码?

发布于 2024-08-08 12:24:17 字数 225 浏览 2 评论 0原文

我设置了一个简单的 Web 应用程序,管理员可以在其中创建用户。用户并不创造自己。管理员所要做的就是输入用户名和电子邮件,然后将临时密码发送给用户以供他们登录。该电子邮件以纯文本格式发送。如果用户首次登录,则需要更改密码并输入安全问题和答案。用户显然必须知道他们的临时密码才能第一次登录,这是我知道让他们知道的唯一方法(通过电子邮件)。另一种选择是让管理员致电用户并通过电话或亲自告诉他们临时密码,但这并不实用。我该如何处理这样的情况?

I have a simple web application set up where admins can create users. Users do not create themselves. All an admin has to do is enter a username and an e-mail and a temporary password is sent to the user for them to login. This e-mail is sent in plain text format. If the user is logging on for the first time, they are required to change their password and enter a security question and answer. The user obviously has to know their temporary password in order to login for the first time and this is the only way I know of letting them know (through e-mail). The other option would be to have the admin call the user and tell them over the phone or in person their temporary password, but this is not practical. How could I handle a situation like this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

笑看君怀她人 2024-08-15 12:24:18

我通常使用基于后端邀请记录的临时 URL。本质上,您创建一个邀请记录并根据一些信息(例如用户的电子邮件地址、时间戳和随机值)生成哈希。将哈希存储为邀请记录的一部分,然后向他们发送一个以哈希作为参数的 url。

当他们单击链接时,会查找邀请并验证它是否存在且尚未使用 - 然后允许他们设置密码并使邀请无效。

它不再需要发送任何类型的密码,如果您愿意,您还可以在邀请记录上设置过期时间。

I typically use a temporary url based on an invite record on the back end. Essentially you create an invite record and generate a hash based on some information perhaps the users email address, a timestamp and a random value. Store the hash as part of the invite record and then send them a url with the hash as the parameter.

When they click the link lookup the invite and validate that it exists and has not been used - then allow them to setup their password and invalidate the invite.

It gets rid of the need to send any sort of password and you can set an expiry on your invite records if you want as well.

凉墨 2024-08-15 12:24:18

您描述的情况很常见 - 通过电子邮件发送临时密码并要求在首次登录时更改它。除非您对该模型有特定的问题,否则我认为没有理由不使用它。让管理员呼叫用户可能会变得复杂 - 我会不惜一切代价避免这种情况。

The scenario you describe is very common- emailing a temporary password and requiring it to be changed on first login. Unless you have a specific problem with this model I see no reason not to use it. Having an admin call users can get complicated- I would avoid this at all costs.

临走之时 2024-08-15 12:24:18

您可以生成一个自定义 url,其中密码和用户哈希作为参数,用户必须自行登录。如果攻击者没有信息,哈希值将很难检索

You can generate a custom url with a password and user hash as argument where the user has to log itself. The hash will be difficult to retrieve if the attacker does not have the information

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文