在管理员批准后启用新用户注册. [英] enable new user registrations after admin approval.

查看:79
本文介绍了在管理员批准后启用新用户注册.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用户帐户注册页面..用户在其中输入诸如用户名,密码,电子邮件,姓名等信息.以及点击注册时.用户注册成功.我希望每当用户注册到网络时..他的注册将一直待处理,直到得到管理员的批准为止.在管理员启用受限于Web的用户后,他可以登录,然后可以登录,否则他不能....我该怎么做?

i have users account registration page.. where user put information such as username, password ,email, name, e.t.c. and when the click register. user registration is sucessful. i want that when ever user register to the web.. his registration wil remain pending until it is approved by the admin. after admin enable the user rigestered to web, he can login then he can login otherwise he can''t.... how can i doo that??

推荐答案

如果将用户信息保留在数据库中,则可以有一个类似UserStatus的列.在代码中,它应该类似于枚举集:
If you keep user information in database, you can have a column like UserStatus. In the code, it should be something like enumeration a bit set:
[System.Flags] enum UserStatus {
    None = 0,
    ApprovalPending = 1, //approved if this bit it clear
    Logged = 2,
    //... powers of 2
    Initial = ApprovalPending, // used only internally 
}

//usage:
UserStatus userStatus = UserStatus.Initial;
//same as UserStatus.ApprovalPending; //initial status immediately the user account is created

//to check a set element:
bool approvalPending == (userStatus & UserStatus.ApprovalPending) > 0;

//to include:
userStatus |= UserStatus.ApprovalPending;

//to exclude (approve):
userStatus ^= UserStatus.ApprovalPending;



您的数据库可以在此列中存储一个数值,它是UserStatus枚举值的按位组合,您可以将其从数值类型强制转换为UserStatus并返回.
要进行批准和其他管理操作,您可以拥有一个特殊的管理网页,例如受密码保护,或设计一个特殊的数据库访问应用程序,该应用程序只能在本地网络中访问.

—SA



Your database can store one numeric value in this column, a bitwise combination of UserStatus enumeration values, you can cast it from numeric type to UserStatus and back.

For approvals and other administrative actions, you can have a special administration Web page, say, password protected, or devise a special database access application accessible only within the local network.

—SA


这篇关于在管理员批准后启用新用户注册.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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