protected void Button1_Click(object sender, EventArgs e) { //Submit data to server. Check if account already exists, if not, save the new account //and update Session object. Redirects to member page. string imageString = Session["imageString"].ToString(); if (imageString.Equals(TextBox4.Text)) { EncryptionService.Service1Client proxy = new EncryptionService.Service1Client(); Account account = new Account(proxy.encrypt(TextBox1.Text), proxy.encrypt(TextBox5.Text), proxy.encrypt(TextBox6.Text), proxy.encrypt(TextBox7.Text)); if (!(account.find())) { account.saveAccount(); if (Session["memberLoggedIn"] == null) { Session["memberLoggedIn"] = true; Session["email"] = proxy.encrypt(TextBox5.Text); Response.Redirect("Member.aspx", false); } } else { //alert user if duplicat email/account ClientScript.RegisterStartupScript(this.GetType(), "duplicateAccount", "duplicateAccount()", true); } } else { //alert user that image string failed TextBox4.Text = ""; ClientScript.RegisterStartupScript(this.GetType(), "failed", "failed()", true); //use ASU service to get image and string ImageVerifier.ServiceClient proxy = new ImageVerifier.ServiceClient(); Session["imageString"] = proxy.GetVerifierString(imageLength); Image1.ImageUrl = Uri + Session["imageString"].ToString(); } }
protected void LinkButton_Click(object sender, EventArgs e) { //Manage session states after login //Assign session variables to specific roles after login //validate login Account account = new Account(); EncryptionService.Service1Client proxy = new EncryptionService.Service1Client(); if (account.validate(proxy.encrypt(TextBox1.Text), proxy.encrypt(TextBox2.Text))) { string role = account.getGroup(proxy.encrypt(TextBox1.Text)); if (role == "Customer") { Session["memberLoggedIn"] = true; Session["email"] = proxy.encrypt(TextBox1.Text); Response.Redirect("Member.aspx", false); } else if (role == "Staff1") { Session["staff1LoggedIn"] = true; Session["email"] = proxy.encrypt(TextBox1.Text); Response.Redirect("Staff1.aspx", false); } else if (role == "Staff2") { //Staff 2 has access to all groups Session["staff1LoggedIn"] = true; Session["staff2LoggedIn"] = true; Session["memberLoggedIn"] = true; Session["email"] = proxy.encrypt(TextBox1.Text); Response.Redirect("Staff2.aspx", false); } } else { Response.Write("<script>alert('Incorrect email or incorrect password. Have you registered yet?');</script>"); } }
//calling methods from encryption service protected void Button1_Click(object sender, EventArgs e) { EncryptionService.Service1Client proxy = new EncryptionService.Service1Client(); TextBox2.Text = proxy.encrypt(TextBox1.Text); }