protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { string email = tbEmail.Text.ToLower(); string password = tbPassword.Text; if (SHA256Hash.GenerateSHA256(password) == UserDAO.GetLoginCredentials(email)) { args.IsValid = true; } else { args.IsValid = false; } }
protected void btnSignupTG_Click(object sender, EventArgs e) { if (Page.IsValid) { string name = tbNameTG.Text; string email = tbEmailTG.Text.ToLower(); string pass1 = tbPasswordTG.Text; string pass2 = tbRepeatPassTG.Text; string desc = tbDesc.Text; string lang = tbLang.Text; if (pass1 == pass2 && name != "" && email != "" && pass1 != "") { string hash = SHA256Hash.GenerateSHA256(pass1); TourGuide obj = new TourGuide(name, email, hash, desc, lang, "", ""); TourGuideDAO.InsertTourGuide(obj); Response.Redirect("Login.aspx"); } } }
protected void btnSignupTourist_Click(object sender, EventArgs e) { if (Page.IsValid) { string name = tbNameTourist.Text; string email = tbEmailTourist.Text.ToLower(); string pass1 = tbPasswordTourist.Text; string pass2 = tbRepeatPassTourist.Text; string nation = ddlNation.SelectedValue; if (pass1 == pass2 && name != "" && email != "" && pass1 != "" && nation != "-- Select --") { string hash = SHA256Hash.GenerateSHA256(pass1); Tourist obj = new Tourist(name, email, hash, nation); TouristDAO.InsertTourist(obj); //Michaels Reward insert table stuff (dont touch) int id = Convert.ToInt32(TouristDAO.SelectTouristByEmail(email).UserId); int logincount = 0; int loginstreak = 0; string loyaltytier = "none"; int totaldiscount = 0; int bonuscredits = 10; string membershiptier = "normal"; int creditbalance = 0; int remainbonusdays = 10; bool loggedInLog = false; DateTime loggedInDate = DateTime.Now; bool newDateCheck = true; Reward insertReward = new Reward(id, logincount, loginstreak, loyaltytier, totaldiscount, bonuscredits, membershiptier, creditbalance, remainbonusdays, loggedInLog, loggedInDate, newDateCheck); insertReward.insertNewReward(); Response.Redirect("Login.aspx"); } } }