在验证激活电子邮件之前,如何阻止用户登录其帐户? [英] How can I block a user from logging in to his account until he verifies the activation email ?

查看:121
本文介绍了在验证激活电子邮件之前,如何阻止用户登录其帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个注册页面。用户注册后,激活邮件将发送到他的电子邮箱。我现在面临的问题是,在点击激活邮件中的链接之前,我无法阻止注册用户登录。任何人都可以帮我解决问题吗?

I have created a registration page. After the user is registered a activation email will be send to his email. The problem that I'm facing now is that, I cant able to block the registered user to log in before he clicks the link in the activation email. Can anybody help me to solve the problem ?

推荐答案

将sql中的状态列保持为0.单击激活链接后,将状态更新为1.如果用户没有点击链接然后列保持为0



检查用户登录时的状态。
Maintain a status column in sql as 0.After clicking the activation link update the status as 1.If the user doesn't click the link then column will remain as 0

Check the status when user login.


另一种方法是,生成随机密码在注册时..在注册时没有从用户那里获得密码...在生成密码发送到他/她的电子邮件后,所以他/她将登录他/她的帐户(电子邮件)并且将获取密码,并且当记录检查来自db的密​​码并且用户输入的密码匹配与否时,该传递将是有用的....只是最好的..:)
Another way is, generate random Password at the time of registration..dont get the password from the user at the time of registration... after generating send that password to his/her email, so after he/she will login into his/her account(email) and will get the password and that pass will be usefull when logging check the password from the db and user's entered password matches or not....simply the best..:)


如果你正在使用会员资格(你应该这样)很简单: http:// buddylindsey.com/email-account-activation-with -asp-net-membership-part-1 / [ ^ ]指导您完成整个过程。
If you are using Membership (and you should be) it's pretty simple: http://buddylindsey.com/email-account-activation-with-asp-net-membership-part-1/[^] guides you through the process.


这篇关于在验证激活电子邮件之前,如何阻止用户登录其帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆