📄 resetuserpasswords.aspx
字号:
<%@ Page Language="C#" %>
<script runat="server">
// you'll want to edit the "loggedInUser.IsAdministrator" line to be
// ignored manually if you have lost your cookie. This is a secure check to
// ensure anyone doesn't hit the page and reset all of your users.
//
void Page_Load () {
User loggedInUser = CSContext.Current.User;
if (loggedInUser.IsAdministrator) {
bool sendAnything = false;
UserSet countOfUsers = Users.GetUsers(0, 1, true, true);
UserSet allUsers = Users.GetUsers(0, countOfUsers.TotalRecords, true, true);
Response.Write("TotalRecords=" + allUsers.TotalRecords + "<br>");
foreach (User user in allUsers.Users) {
if (!user.IsAnonymous) {
string newPass = "";
newPass = user.ResetPassword();
Emails.UserPasswordChanged(user, newPass);
Response.Write("<br>Username=" + user.Username + ", newPass=" + newPass);
sendAnything = true;
}
}
if (sendAnything)
Response.Write("<br><br>Reset " + allUsers.TotalRecords + " passwords and queued e-mails for all.");
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -