protected void btnUpdate_Click(object sender, EventArgs e) { if (txtConfirmPassword.Text == txtNewPassword.Text) { AccountConnection account = new AccountConnection(); Qaelo.Models.CompanyModel.Company s = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"]; //Test password if (account.correctCompany(s.Email, Secrecy.HashPassword(txtCurrentPassword.Text)) && account.updateCompanyPassword(s.Id, Secrecy.HashPassword(txtNewPassword.Text), Secrecy.HashPassword(txtCurrentPassword.Text))) { lblSuccess.Text = "Successfuly Updated Password"; lblErrorMessage.Text = ""; } else { lblErrorMessage.Text = "Incorrect Current Password"; lblSuccess.Text = ""; } } else { lblErrorMessage.Text = "New password and confirm Password Do not match "; lblSuccess.Text = ""; } }
protected void btnLogin_Click(object sender, EventArgs e) { //if (txtEmail.Text != "*****@*****.**") //{ // lblErrorMessage.Text = ""; // lblSuccess.Text = "Website under maintenance mode"; // return; //} AccountConnection connection = new AccountConnection(); //Check if the user exists in the unconifirmed accounts if (connection.unconfirmedAccount(txtEmail.Text)) { lblErrorMessage.Text = "Please check your Inbox folder for confirmation email"; lblSuccess.Text = ""; } else { Student s = connection.loginStudent(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (s != null) { Session["STUDENT"] = s; if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("Student")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/Student/students-profile.aspx"); } else if (connection.correctShopOwner(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text))) { Session["SHOPOWNER"] = connection.loginShopOwner(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("Shop")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/Shop/Home.aspx"); } else if (connection.correctEventPoster(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text))) { Session["EVENTPOSTER"] = connection.loginEventPoster(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("EventPoster")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/EventPoster/Home.aspx"); } else if (connection.correctSociety(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text))) { Session["SOCIETY"] = connection.loginSociety(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("Society")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/Society/Home.aspx"); } else if (connection.correctCompany(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text))) { Session["COMPANY"] = connection.loginCompany(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("Company")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/Company/Home.aspx"); } else if (connection.correctPropertyManager(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text))) { Session["PROPERTYMANAGER"] = connection.loginPropertyManager(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)); if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Contains("Accommodation")) { Response.Redirect("~/Web/" + Request.QueryString["page"].ToString()); } Response.Redirect("~/Web/Users/Accommodation/landlord-my-rooms.aspx"); } else if (txtPassword.Text == "2g@63po" && txtEmail.Text == "*****@*****.**") { //connection.adminAccess(txtEmail.Text, Secrecy.HashPassword(txtPassword.Text)) Session["ADMIN"] = "*****@*****.**"; Response.Redirect("~/Web/Users/Admin/ListOfUsers.aspx"); } else { lblErrorMessage.Text = "Email or Password is incorrect"; lblSuccess.Text = ""; } } }