//Register Component Register Handler: //------------------------------------------------ public void RegisterHandler(string username, string password, string confirmPassword, EventArgs e) { if (password.Equals(confirmPassword)) { string encryptedPassword = TeamLibrary.Crypto.encryption(password); //Insert New User: string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\Staff.xml"); if (XMLProccess.findUser(fLocation, username) == null) { XMLProccess.addUser(fLocation, username, encryptedPassword); //Create A login Cookie for managing the session: HttpCookie loginCookie = new HttpCookie("staffMember"); //Create Staff Cookie. loginCookie["username"] = username; //Set Staff Cookie username. loginCookie.Expires = DateTime.Now.AddMonths(1); //Set Cookie Expiration for 1 month. Response.Cookies.Add(loginCookie); alert.Text = "Login Sucess!"; Response.Redirect("Staff"); } else { alert.Text = "Username already exist"; } } else { alert.Text = "Passwords did not match!"; } }
public void LoginHandler(string username, string password, EventArgs e) { //TODO:: ENCRYPT PASSWORD BEFORE COMPARISON string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\Staff.xml"); XmlNode node = XMLProccess.findStaffUser(fLocation, username); if (node == null) { alert.Text = "User does not exist"; } else if (string.Compare(node["password"].InnerText, password) != 0) { alert.Text = "wrong Password"; } else { //Create A login Cookie for managing the session: HttpCookie loginCookie = new HttpCookie("staffMember"); //Create Staff Cookie. loginCookie["username"] = username; //Set Staff Cookie username. loginCookie.Expires = DateTime.Now.AddMonths(1); //Set Cookie Expiration for 1 month. Response.Cookies.Add(loginCookie); alert.Text = "Login Sucess!"; Response.Redirect("Staff"); } }
protected void Page_Load(object sender, EventArgs e) { string[] list; string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\Staff.xml"); list = XMLProccess.getUserList(fLocation); for (int i = 0; i < list.Length; i++) { txtStaffs.Text += (list[i] + "\n"); } }
public void LoginHandler(string username, string password, EventArgs e) { string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\Staff.xml"); XmlNode node = XMLProccess.findUser(fLocation, username); if (node == null) { lor.Text = "User does not exist"; } else if (string.Compare(node["password"].InnerText, password) != 0) { lor.Text = "wrong Password"; } else { lor.Text = "Login Sucess!"; } }
protected void Page_Load(object sender, EventArgs e) { //Cookie access Control //------------------------------------------------ if ((Request.Cookies["staffMember"] == null) && (Request.Cookies["admin"] == null)) { Response.Redirect("StaffLogin"); } //------------------------------------------------ txtStaffs.Text = ""; string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\Staff.xml"); string[] userNames = XMLProccess.getUserList(fLocation); foreach (string s in userNames) { txtStaffs.Text += s + "\n"; } }