resetuserpasswords.aspx

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· ASPX 代码 · 共 39 行

ASPX
39
字号
<%@ 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 + =
减小字号Ctrl + -
显示快捷键?