我不明白电子邮件激活是如何工作的
我想验证用户电子邮件是否有效,并将此电子邮件转换为他在我的系统中的ID。 但我不知道如何在邮件中创建一个链接,以激活帐户(例如 Facebook 和其他帐户) )并且我真的不明白选择链接时会发生什么。
我想生成一个像“sdklbsdgk4493”这样的密钥来输入一次——这样猜测就很难了,但对于许多人来说复制和粘贴并不是微不足道的,我可能会用这个解决方案惹恼他们。
有什么想法或想法吗?
ps:我正在使用 c# 工作,所以如果它可以用 c# 完成...那就太好了:)
谢谢 Asaf
I want to verify that the user email is valid and turn this email into his id in my system.
Yet I don't know how to make a link in the mail, that activates the account like(facebook and others
) and I don't really understand what happens when the link is selected.
I thought of generating a key like "sdklbsdgk4493" to enter once- so that guessing is hard, yet for many people copy and paste is not trivial and I may annoy them with this solution.
Any thoughts or ideas?
p.s: I'm working in c# so if it can be done with c#... it will be great :)
Thanks Asaf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当您在数据库中插入新用户时,其状态应为“已停用”,并且插入您生成的“GUID”。您向他们发送一个指向您的激活页面的链接,该链接将在查询字符串中包含此 GUID。它看起来像这样:
www.YourSite.com/Activation.aspx?GUID=jdfhg43h98234
在
Activation.aspx
页面中,您从查询字符串中获取此 GUID 并进行比较它是您在数据库中拥有的那个。然后,您激活具有该 GUID 的帐户。When you insert a new user in the Database, their status should be "Deactivated" and you insert a "GUID" you generate alongside. You send them a link to your activation Page which would contain this GUID in the Query String. It will look like this:
www.YourSite.com/Activation.aspx?GUID=jdfhg43h98234
In the
Activation.aspx
page, you take this GUID from the Query String and compare it to the one you have in the Database. You then activate the Account having that GUID.创建用户
为用户生成唯一的字符串
有一个表来存储唯一的字符串,用户Id,一个布尔值,保存它是否被激活、生成日期、到期日期,如果您对这些激活字符串有不同的用途,则类型(链接到另一个表)
现在在电子邮件中您应该获取字符串并将其写入电子邮件中,并附上您将用于验证的页面的链接,例如whatever.com/verify.aspx?activationString=hd3fd33fen342n43
在此页面中,您可以在包含的表中进行查询搜索密钥以及是否尚未验证
Create the user
Generate a unique string for the user
Have a Table that stores the unique string, the user Id ,a boolean that holds whether it got activated or not, the generation date, the expiration date and if you have different uses for these activation strings, the type(link to another table)
Now within the email you should get the string and write it within the email along with a link to the page you're going to use for validation such as whatever.com/verify.aspx?activationString=hd3fd33fen342n43
Within this page you do a query search within the table that holds the keys and if its not already validated
您在数据库中拥有用户表(或者存储用户列表的任何位置),只需添加一列来说明用户的邮件是否经过验证。
在验证邮件中添加一个链接,该链接会使用特定于用户的代码(例如数据库中的索引)触发一些 PHP。 PHP 会将用户的“validated”列设置为 true,然后就完成了。
它并不像乍看起来那么复杂。
You have your users table in the DB (or where ever it is that you store your list of users), just add a column stating if the user's mail is validated.
To the validation mail add a link that fires some PHP with a user-specific code (like it's index in the DB). The PHP will set the user's "validated" column to true, and it'll be done.
It's not as complicated as it may seem at first.
这个想法是创建一个随机密钥,将其保存到连接到用户帐户的数据库中,提供一个指向用户电子邮件的链接,该链接可能指向一个网络服务(或常规网站),该网络服务将密钥作为查询字符串,然后将激活连接到该特定密钥的帐户。
The idea is to create a random key, save it to the database connected to the useraccount, supplying a link to the users e-mail which could point to a webservice(or regular website) which takes the key as a querystring which will then activate the account connected to that specific key.