protected void Page_Load(object sender, EventArgs e) { Session["ActiveLeftNav"] = "TermsOfUse"; Classes.cLogin TermsOfUse = new Classes.cLogin(); TermsOfUse.getTermsOfUse(); lblTermsOfUse.Text = TermsOfUse.TermsOfUseText; }
protected void btnForgotUsername_Click(object sender, EventArgs e) { //TODO-Rick-1 Use the email address to go get the username and email it to them. If that email address has multiple usernames, send them all of them. if (txtEmailAddress.Text == "") { lblUsernameISEmail.Text = "Fill in the email address and click the 'Forgot Username' button again."; } else { Classes.cLogin ValidUser = new Classes.cLogin(); ValidUser.GetUsernameByEmail(txtEmailAddress.Text); if (ValidUser.Email == "") { lblUsernameISEmail.Text = "This email address is not associated with a LARP Portal account. Please click 'Sign Up' to create an account."; } else { if (ValidUser.Email == ValidUser.Username) { lblUsernameISEmail.Text = "Your email address is your username. We recommend you change your username after logging in."; txtUsername.Text = ValidUser.Username; } else { //TODO-Rick-1 Send an email to the user with just their username. ForgotUsername(txtEmailAddress.Text); lblUsernameISEmail.Text = "An email has been sent to this email address with your username. Use that username to fill out this form and complete the process."; } } } lblUsernameISEmail.Visible = true; }
public void LoadMainLinks() { // Load the main links at the top right of the master page. These are the same for everyone, except for home which will be member only int intTabsNeeded; int SecurityRole = 1; string hrefline; string TabName; string PageName; string TabClass; string TabIcon; int UserID = 0; //UserID = int.TryParse(Session["UserID"].ToString(), out iTemp); UserID = ((int?)Session["UserID"] ?? 0); Classes.cLogin RoleTabs = new Classes.cLogin(); RoleTabs.LoadTabsBySecurityRole(SecurityRole); intTabsNeeded = RoleTabs.TabCount; DataTable TopTabTable = new DataTable(); TopTabTable.Columns.Add("href_main"); for (int i = 0; i <= intTabsNeeded; i++) { if (i < intTabsNeeded) { PageName = RoleTabs.lsPageTabs[i].CallsPageName.ToString(); TabClass = RoleTabs.lsPageTabs[i].TabClass.ToString(); TabIcon = RoleTabs.lsPageTabs[i].TabIcon.ToString(); TabName = RoleTabs.lsPageTabs[i].TabName.ToString(); switch (TabName) { case "Home": if (UserID == 0) { hrefline = "skip"; } else { hrefline = "<li><a href=" + "\"" + PageName + "\"" + ">" + TabName + "</a></li>"; } break; default: hrefline = "<li><a href=" + "\"" + PageName + "\"" + ">" + TabName + "</a></li>"; break; } } else { hrefline = "<li><b>Welcome " + Session["LoginName"].ToString() + "</b></li>"; } DataRow TopTabRow = TopTabTable.NewRow(); TopTabRow["href_main"] = hrefline; if (hrefline != "skip") { TopTabTable.Rows.Add(TopTabRow); } } menu_ul_main.DataSource = TopTabTable; menu_ul_main.DataBind(); }
protected void ForgotUsername(string EmailAddress) { string strBody; string FirstName = ""; string LastName = ""; string LoginUsername = ""; Classes.cLogin Username = new Classes.cLogin(); Username.GetUsernameByEmail(EmailAddress); FirstName = Username.FirstName; LastName = Username.LastName; LoginUsername = Username.Username; string strSubject = "Your LARP Portal Username"; strBody = "Hi " + FirstName + ",<p></p><p></p>Your LARP Portal username is <b>" + LoginUsername + "</b>. If you need further assistance please contact us "; strBody = strBody + "via email at [email protected].<br><br>"; strBody = strBody + @"Click <u><a href=""https://www.larportal.com"">here</a></u> to log in."; Classes.cEmailMessageService MailServer = new Classes.cEmailMessageService(); try { MailServer.SendMail(strSubject, strBody, EmailAddress, "", "", "ForgotUsername", "System"); mvInfoRequest.SetActiveView(vwSentEmail); } catch (Exception) { mvInfoRequest.SetActiveView(vwIssue); } }
protected void btnSaveNewPassword_Click(object sender, EventArgs e) { int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(tbPassword.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { lblErrorPasswords.Text = PasswordValidate.PasswordFailMessage + "."; tbPassword.Text = ""; tbPasswordConfirm.Text = ""; divErrorPasswords.Visible = true; tbPassword.Focus(); } else { int intUserID = 0; int intUserSecurityID = 0; if ((int.TryParse(Session["UserID"].ToString(), out intUserID)) && (int.TryParse(hidUserSecurityID.Value, out intUserSecurityID))) { Classes.cLogin UpdateSecurity = new Classes.cLogin(); UpdateSecurity.UpdateQAandPassword(intUserSecurityID, intUserID, hidQuestion1.Value, hidUpdate1.Value, hidQuestion2.Value, hidUpdate2.Value, hidQuestion3.Value, hidUpdate3.Value, hidAnswer1.Value, hidUpdate1.Value, hidAnswer2.Value, hidUpdate2.Value, hidAnswer3.Value, hidUpdate3.Value, tbPassword.Text); mvInfoRequest.SetActiveView(vwFinalStep); } } }
protected void Page_Load(object sender, EventArgs e) { Session["ActiveLeftNav"] = "LearnMore"; Classes.cLogin LearnMore = new Classes.cLogin(); LearnMore.getLearnMore(); lblLearnMore.Text = LearnMore.LearnMoreText; }
protected void Page_Load(object sender, EventArgs e) { Session["ActiveLeftNav"] = "ContactUs"; Classes.cLogin ContactUs = new Classes.cLogin(); ContactUs.getContactUs(); lblContactUs.Text = ContactUs.ContactUsText; }
protected void Page_Load(object sender, EventArgs e) { Session["ActiveLeftNav"] = "AboutUs"; Classes.cLogin AboutUs = new Classes.cLogin(); AboutUs.getAboutUs(); lblAboutUs.Text = AboutUs.AboutUsText; }
protected void btnGetPassword_Click(object sender, EventArgs e) { Classes.cLogin ValidUser = new Classes.cLogin(); ValidUser.ValidateUserForPasswordReset(txtUsername.Text, txtEmailAddress.Text, txtLastName.Text); if (ValidUser.MemberID == 0) { //If it's not valid flash a message with a clear button and tell them to try again. divInvalid.Visible = true; txtEmailAddress.Focus(); } else //If it's valid check for security questions. { Session["UserID"] = ValidUser.MemberID; hidUserSecurityID.Value = ValidUser.UserSecurityID.ToString(); // Save all the values to the hidden fields so we can get them later. hidAnswer1.Value = ValidUser.SecurityAnswer1; hidAnswer2.Value = ValidUser.SecurityAnswer2; hidAnswer3.Value = ValidUser.SecurityAnswer3; hidQuestion1.Value = ValidUser.SecurityQuestion1; hidQuestion2.Value = ValidUser.SecurityQuestion2; hidQuestion3.Value = ValidUser.SecurityQuestion3; if ((!String.IsNullOrEmpty(ValidUser.SecurityQuestion1)) || (!String.IsNullOrEmpty(ValidUser.SecurityQuestion2)) || (!String.IsNullOrEmpty(ValidUser.SecurityQuestion3))) { // At least one of the questions is filled in. mvInfoRequest.SetActiveView(vwAnswerQuestions); divUserQuestion2.Visible = false; divUserQuestion3.Visible = false; lblAnswerQuestionS.Visible = false; lblUserQuestion1.Text = ValidUser.SecurityQuestion1; hidUserAnswer1.Value = ValidUser.SecurityAnswer1; if (!String.IsNullOrEmpty(ValidUser.SecurityQuestion2)) { lblAnswerQuestionS.Visible = true; divUserQuestion2.Visible = true; lblUserQuestion2.Text = ValidUser.SecurityQuestion2; hidUserAnswer2.Value = ValidUser.SecurityAnswer2; } if (!String.IsNullOrEmpty(ValidUser.SecurityQuestion3)) { lblAnswerQuestionS.Visible = true; divUserQuestion3.Visible = true; lblUserQuestion3.Text = ValidUser.SecurityQuestion3; hidUserAnswer3.Value = ValidUser.SecurityAnswer3; } } else { mvInfoRequest.SetActiveView(vwSecurityQuestions); tbQuestion1.Focus(); } } }
protected void Page_Load(object sender, EventArgs e) { Session["ActiveTopNav"] = "TestingResults"; Session["ActiveLeftNav"] = "TestingResults"; Classes.cLogin TestingResults = new Classes.cLogin(); TestingResults.getTestingResults(); lblTestingResults.Text = TestingResults.TestingResultsText; }
/// <summary> /// If this is called it means the activation code was entered and is correct. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnValidateAccount_Click(object sender, EventArgs e) { Classes.cLogin Login = new Classes.cLogin(); Login.Load(tbUserName.Text, Session["SavePassword"].ToString()); Login.SecurityResetCode = ""; Login.ClearNewAccount(Login.UserSecurityID, Login.MemberID); MemberLogin(Login); }
public void LoadPageFooter() { string SiteFoot = " "; Classes.cLogin SiteFooter = new Classes.cLogin(); SiteFooter.SetPageFooter(); SiteFoot = SiteFooter.SiteFooter; Session["PageFooter"] = SiteFoot; }
protected void Page_Load(object sender, EventArgs e) { string WhatIsLARPingText; Session["ActiveLeftNav"] = "WhatIsLARPing"; Classes.cLogin WhatIsIt = new Classes.cLogin(); WhatIsIt.getWhatIsLARPing(); WhatIsLARPingText = WhatIsIt.WhatIsLARPingText; lblWhatIsLARPing.Text = WhatIsLARPingText; }
public void LoadTopTab(int SecurityRole, int UnreadCount) { // Load the user based security tabs on the master page. These change based on user security levels. int intTabsNeeded; string hrefline; string TabName; string ActiveState; string PageName; string TabClass; string TabIcon; Classes.cLogin RoleTabs = new Classes.cLogin(); RoleTabs.LoadTabsBySecurityRole(SecurityRole); intTabsNeeded = RoleTabs.TabCount - 1; DataTable TopTabTable = new DataTable(); TopTabTable.Columns.Add("href_li"); TopTabTable.Columns.Add("DisplayText"); for (int i = 0; i <= intTabsNeeded; i++) { PageName = RoleTabs.lsPageTabs[i].CallsPageName.ToString(); TabClass = RoleTabs.lsPageTabs[i].TabClass.ToString(); TabIcon = RoleTabs.lsPageTabs[i].TabIcon.ToString(); TabName = RoleTabs.lsPageTabs[i].TabName.ToString(); if (Session["ActiveTopNav"] == null) { Session["ActiveTopNav"] = "Campaigns"; } if (Session["ActiveTopNav"].ToString() == TabName) { ActiveState = " class=" + "\"" + "active" + "\"" + ">"; } else { ActiveState = ">"; } if (RoleTabs.lsPageTabs[i].TabAlert.ToString() == " ") { TabName = " " + TabName; } else { TabName = " " + TabName + RoleTabs.lsPageTabs[i].TabAlert.ToString() + UnreadCount; } hrefline = "<li" + ActiveState + "<a href=" + "\"" + PageName + "\"" + "\"><span class=\"" + "\"" + TabClass + " " + TabIcon + "\"> </span>" + TabName + "</a></li>"; DataRow TopTabRow = TopTabTable.NewRow(); TopTabRow["href_li"] = hrefline; TopTabRow["DisplayText"] = TabName; TopTabTable.Rows.Add(TopTabRow); } //Uncomment next two lines if top tabs are re-enabled //menu_ul_1.DataSource = TopTabTable; //menu_ul_1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { tbUserName.Attributes.Add("PlaceHolder", "Username"); tbPassword.Attributes.Add("PlaceHolder", "Password"); btnClose.Attributes.Add("data-dismiss", "modal"); if (Session["CompileDate"] is null) { DateTime dtCompileTime = Classes.cCompileDate.GetLinkerDateTime(Assembly.GetExecutingAssembly()); string sCompileTime = "Compiled: " + dtCompileTime.ToString("g", CultureInfo.CreateSpecificCulture("en-US")); Session["CompileDate"] = sCompileTime; } lblVersion.Text = Session["CompileDate"].ToString(); if ((Request.Url.Host.ToUpper().Contains("BETA.")) || (Request.Url.Host.ToUpper().Contains("LOCALHOST"))) { lblVersion.ForeColor = System.Drawing.Color.Black; } else { lblVersion.ForeColor = System.Drawing.Color.Transparent; } //lblVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString() + " " + // File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location).ToString(); tbUserName.Focus(); // Added to redirect http to https setSecureProtocol(true); // if (!IsPostBack) { mvMainScreen.SetActiveView(vwLogin); // Destroys everything in the session which is essentially what logging out does. Session.Clear(); Session["LoginName"] = "Guest"; // Until login changes it Session["UserID"] = 0; // Until login changes it Session["UserName"] = "******"; Session["Guest"] = "Y"; Session["SecurityRole"] = 0; // Until login changes it Session["CurrentPagePermission"] = "True"; // We'll assume that wherever you were last you can still be there when the system takes you there on login Session.Remove("SuperUser"); // Don't care what SuperUser value is, if it exists that's good enough. string SiteOpsMode; Classes.cLogin OpsMode = new Classes.cLogin(); OpsMode.SetSiteOperationalMode(); SiteOpsMode = OpsMode.SiteOperationalMode; Session["OperationalMode"] = SiteOpsMode; // int x = 10; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Classes.cLogin LearnMore = new Classes.cLogin(); LearnMore.getTermsOfUse(); lblTestOfUseMessage.Text = LearnMore.TermsOfUseText; btnSignUp.Attributes.Add("disabled", "true"); lblPasswordReqs.ToolTip = "LARP Portal login passwords must be at least 7 characters long and contain at least " + "1 uppercase letter, 1 lowercse letter, 1 number and 1 special character"; } btnCloseMessage.Attributes.Add("data-dismiss", "modal"); }
protected void btnValidateAccount_Click(object sender, EventArgs e) { Classes.cLogin Login = new Classes.cLogin(); Login.Load(Session["AttemptedUsername"].ToString(), Session["AttemptedPassword"].ToString()); if (txtSecurityResetCode.Text == Login.SecurityResetCode) { Login.SecurityResetCode = ""; Login.ClearNewAccount(Login.UserSecurityID, Login.MemberID); MemberLogin(Session["AttemptedUsername"].ToString(), Session["AttemptedPassword"].ToString()); } else { lblInvalidActivationKey.Visible = true; txtSecurityResetCode.Text = ""; txtSecurityResetCode.Focus(); } }
protected void btnLogin_Click(object sender, EventArgs e) { Session["AttemptedPassword"] = txtPassword.Text; Session["AttemptedUsername"] = txtUserName.Text; if (Page.IsValid) { Classes.cLogin Login = new Classes.cLogin(); Login.Load(txtUserName.Text, txtPassword.Text); if (Login.MemberID == 0) // Invalid user, fall straight to fail logic { Session["SecurityRole"] = 0; lblInvalidLogin.Visible = true; lblInvalidLogin2.Visible = true; Login.LoginFail(txtUserName.Text, txtPassword.Text); } else // Valid member. Is there a lock? { if (Login.SecurityResetCode != "") { if (Login.LoginCount == 0) // New user. First time activation. { lblSecurityResetCode.Text = "Account activation code"; lblSecurityResetCode.ToolTip = "This code can be found in the welcome email that was sent when you registered for a LARP Portal account."; lblSecurityResetCode.Visible = true; Session["SavePassword"] = txtPassword.Text; txtSecurityResetCode.Visible = true; btnValidateAccount.Visible = true; btnLogin.Visible = false; txtSecurityResetCode.Focus(); txtPassword.Text = Session["SavePassword"].ToString(); } else // Existing user with a bigger problem { // TODO-Rick-3 Define how to handle user account locks on attempted login } } else // Valid member. Login. { Login.CheckForEmail(Login.MemberID); MemberLogin(Session["AttemptedUsername"].ToString(), Session["AttemptedPassword"].ToString()); } } } }
protected void ForgotUsername(string EmailAddress) { string strBody; string FirstName = ""; string LastName = ""; string LoginUsername = ""; Classes.cLogin Username = new Classes.cLogin(); Username.GetUsernameByEmail(EmailAddress); FirstName = Username.FirstName; LastName = Username.LastName; LoginUsername = Username.Username; string strFromUser = "******"; string strFromDomain = "larportal.com"; string strFrom = strFromUser + "@" + strFromDomain; string strSMTPPassword = "******"; string strSubject = "Your LARP Portal Username"; strBody = "Hi " + FirstName + ",<p></p>Your LARP Portal username is " + LoginUsername + ". If you need further assistance please contact us "; strBody = strBody + "contact us via email at [email protected]."; MailMessage mail = new MailMessage(strFrom, EmailAddress); SmtpClient client = new SmtpClient("smtpout.secureserver.net", 80); client.EnableSsl = false; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(strFrom, strSMTPPassword); client.Timeout = 10000; mail.Subject = strSubject; mail.Body = strBody; mail.IsBodyHtml = true; try { client.Send(mail); } catch (Exception) { lblUsernameISEmail.Text = "There was an issue. Please contact us at [email protected] for assistance."; lblUsernameISEmail.Visible = true; } }
protected void btnLogin_Click(object sender, EventArgs e) { Classes.cLogin Login = new Classes.cLogin(); Login.Load(tbUserName.Text, tbPassword.Text); if (Login.MemberID == 0) // Invalid user, fall straight to fail logic { Session["SecurityRole"] = 0; lblInvalidLogin.Visible = true; Login.LoginFail(tbUserName.Text, tbPassword.Text); } else { if (Login.SuperUser) { Session["SuperUser"] = 1; } // Valid member. Is there a lock? if (!String.IsNullOrEmpty(Login.SecurityResetCode)) { if (Login.LoginCount == 0) // New user. First time activation. { mvMainScreen.SetActiveView(vwActivate); hidActivateCode.Value = Login.SecurityResetCode; Session["SavePassword"] = tbPassword.Text; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "MyApplication", "openActivationCode();", true); Session["SavePassword"] = tbPassword.Text; tbActivationCode.Focus(); } else // Existing user with a bigger problem { // TODO-Rick-3 Define how to handle user account locks on attempted login } } else // Valid member. Login. { Login.CheckForEmail(Login.MemberID); MemberLogin(Login); } } }
protected void btnGetPassword_Click(object sender, EventArgs e) { //TODO-Rick-1 Validate the username, email, last name combination. Classes.cLogin ValidUser = new Classes.cLogin(); ValidUser.ValidateUserForPasswordReset(txtUsername.Text, txtEmailAddress.Text, txtLastName.Text); if (ValidUser.MemberID == 0) { //If it's not valid flash a message with a clear button and tell them to try again. lblInvalidCombination.Visible = true; btnInvalidCombination.Visible = true; } else //If it's valid check for security questions. { Session["UserID"] = ValidUser.MemberID; UserSecurityID.Text = ValidUser.UserSecurityID.ToString(); string An1 = ValidUser.SecurityAnswer1; string An2 = ValidUser.SecurityAnswer2; string An3 = ValidUser.SecurityAnswer3; string Qu1 = ValidUser.SecurityQuestion1; string Qu2 = ValidUser.SecurityQuestion2; string Qu3 = ValidUser.SecurityQuestion3; SetQandA(Qu1, Qu2, Qu3, An1, An2, An3); if (ValidUser.SecurityQuestion1 == "") //If no security questions, make 'add question panel visible'. { pnlSetQuestion.Visible = true; pnlIDYourself.Visible = false; txtSecurityQ1.Focus(); } else //If at least one question, make the 'answer question panel visible. { lblAskQuestion1.Text = "Security Question 1: " + Q1.Text; lblAskQuestion2.Text = "Security Question 2: " + Q2.Text; lblAskQuestion3.Text = "Security Question 3: " + Q3.Text; pnlAnswerQuestion.Visible = true; pnlIDYourself.Visible = false; txtAnswerQuestion1.Focus(); } } }
public void LoadMainLinks() { // Load the main links at the top right of the master page. These are the same for everyone. int intTabsNeeded; int SecurityRole = 1; string hrefline; string TabName; string PageName; string TabClass; string TabIcon; Classes.cLogin RoleTabs = new Classes.cLogin(); RoleTabs.LoadTabsBySecurityRole(SecurityRole); intTabsNeeded = RoleTabs.TabCount; DataTable TopTabTable = new DataTable(); TopTabTable.Columns.Add("href_main"); for (int i = 0; i <= intTabsNeeded; i++) { if (i < intTabsNeeded) { PageName = RoleTabs.lsPageTabs[i].CallsPageName.ToString(); TabClass = RoleTabs.lsPageTabs[i].TabClass.ToString(); TabIcon = RoleTabs.lsPageTabs[i].TabIcon.ToString(); TabName = RoleTabs.lsPageTabs[i].TabName.ToString(); hrefline = "<li><a href=" + "\"" + PageName + "\"" + ">" + TabName + "</a></li>"; } else { //hrefline = "<li><b>Welcome " + Session["LoginName"].ToString() + "</b></li>"; hrefline = ""; } DataRow TopTabRow = TopTabTable.NewRow(); TopTabRow["href_main"] = hrefline; TopTabTable.Rows.Add(TopTabRow); } menu_ul_main.DataSource = TopTabTable; menu_ul_main.DataBind(); }
protected void btnGetUsername_Click(object sender, EventArgs e) { Classes.cLogin ValidUser = new Classes.cLogin(); ValidUser.GetUsernameByEmail(txtEmailAddress.Text); if (ValidUser.Email == "") { divInvalid.Visible = true; } else { if (ValidUser.Email == ValidUser.Username) { lblMessage.Text = "Your email address is your username. We recommend you change your username after logging in."; mvInfoRequest.SetActiveView(vwSentEmail); } else { lblMessage.Text = "An email has been sent to this email address with your username. Use that username to fill out this form and complete the process."; ForgotUsername(txtEmailAddress.Text); } } }
protected void btnSubmitPasswordChange_Click(object sender, EventArgs e) { int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(txtNewPassword.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { if (lblPasswordErrors.Text != "") { lblPasswordErrors.Text = lblPasswordErrors.Text + "<p></p>" + PasswordValidate.PasswordFailMessage + "."; } else { lblPasswordErrors.Text = PasswordValidate.PasswordFailMessage + "."; } txtNewPassword.Text = ""; txtNewPasswordRetype.Text = ""; lblPasswordErrors.Visible = true; txtNewPassword.Focus(); } else { int UserID = ((int)Session["UserID"]); int iTemp; int intUserSecurityID = 0; if (int.TryParse(UserSecurityID.Text, out iTemp)) { intUserSecurityID = iTemp; } Classes.cLogin UpdateSecurity = new Classes.cLogin(); UpdateSecurity.UpdateQAandPassword(intUserSecurityID, UserID, Q1.Text, Q1Update.Text, Q2.Text, Q2Update.Text, Q3.Text, Q3Update.Text, A1.Text, A1Update.Text, A2.Text, A2Update.Text, A3.Text, A3Update.Text, txtNewPassword.Text); pnlSetPasswords.Visible = false; pnlFinalStep.Visible = true; } }
protected void Page_PreRender(object sender, EventArgs e) { Classes.cLogin WhatIsIt = new Classes.cLogin(); WhatIsIt.getWhatIsLARPing(); lblWhatIsLARPing.Text = WhatIsIt.WhatIsLARPingText; }
protected void Page_Load(object sender, EventArgs e) { Classes.cLogin Updates = new Classes.cLogin(); Updates.NightlyUpdates(); Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();"); }
protected void Page_PreRender(object sender, EventArgs e) { //if (Request.Url.Host.ToUpper().Contains("BETA.")) //{ // lblMessage.Text = "Beta Site"; // SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString); // if (ConnPieces != null) // lblMessage.Text += " Database: " + ConnPieces.InitialCatalog; //} //else if (Request.Url.Host.ToUpper().Contains("LOCALHOST")) //{ // lblMessage.Text = "Local Host"; // SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString); // if (ConnPieces != null) // lblMessage.Text += " Database: " + ConnPieces.InitialCatalog; //} if (Session["CompileDate"] is null) { DateTime dtCompileTime = Classes.cCompileDate.GetLinkerDateTime(Assembly.GetExecutingAssembly()); string sCompileTime = "Compiled: " + dtCompileTime.ToString("g", CultureInfo.CreateSpecificCulture("en-US")); Session["CompileDate"] = sCompileTime; } SqlConnectionStringBuilder ConnPieces = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString); if (ConnPieces != null) { lblMessage.Text = Session["CompileDate"].ToString() + " Database: " + ConnPieces.InitialCatalog; } lblMessage.ForeColor = System.Drawing.Color.Transparent; if ((Session["SuperUser"] != null) || (Request.Url.Host.ToUpper().Contains("BETA.")) || (Request.Url.Host.ToUpper().Contains("LOCALHOST"))) { lblMessage.ForeColor = System.Drawing.Color.White; } Classes.cLogin SiteFooter = new Classes.cLogin(); SiteFooter.SetPageFooter(); lblFooter.Text = SiteFooter.SiteFooter; if ((!IsPostBack) || (Session["ReloadCampaigns"] != null)) { if (Session["ReloadCampaigns"] != null) { Session.Remove("CampaignID"); Session.Remove("CampaignName"); Session.Remove("CampaignList"); Session.Remove("RoleString"); } Session.Remove("ReloadCampaigns"); if (Session["Guest"] != null) { mvMenuArea.SetActiveView(vwGuest); lblUserName.Text = "Guest"; return; } mvMenuArea.SetActiveView(vwFullMenu); lblUserName.Text = Session["UserName"].ToString(); if (!DisplayAllOptions) { if (Session["CampaignID"] != null) { int iCampaignID; if (int.TryParse(Session["CampaignID"].ToString(), out iCampaignID)) { if (iCampaignID < 0) { Session.Remove("CampaignID"); } } } } LoadData(); } Classes.cPlayerRoles Roles = new Classes.cPlayerRoles(); Roles.Load(UserID, 0, CampaignID, DateTime.Today); Classes.cURLPermission permissions = new Classes.cURLPermission(); bool PagePermission = true; string DefaultUnauthorizedURL = ""; string CurrentPage = Request.RawUrl; if (CurrentPage.ToUpper().EndsWith(".ASPX")) { CurrentPage = CurrentPage.Substring(0, CurrentPage.Length - 5); } permissions.GetURLPermissions(CurrentPage, UserName, Roles.PlayerRoleString); PagePermission = permissions.PagePermission; DefaultUnauthorizedURL = permissions.DefaultUnauthorizedURL; if (!PagePermission) { Response.Redirect(DefaultUnauthorizedURL); } // Save current page to database so when person logs back in it can go to last page. string PageName = Request.Url.AbsolutePath; Classes.cLogin LastLoggedIn = new Classes.cLogin(); LastLoggedIn.LogLastPage(UserID, PageName); }
protected void btnSignUp_Click(object sender, EventArgs e) { if (Session["AttemptedPassword"] == null) { txtPasswordNew.Text = ""; } else { txtPasswordNew.Text = Session["AttemptedPassword"].ToString(); txtPasswordNew.Attributes.Add("value", txtPasswordNew.Text); } if (Session["AttemptedPasswordRetype"] == null) { txtPasswordNewRetype.Text = ""; } else { txtPasswordNewRetype.Text = Session["AttemptedPasswordRetype"].ToString(); txtPasswordNewRetype.Attributes.Add("value", txtPasswordNewRetype.Text); } if (Page.IsValid) { lblSignUpErrors.Text = ""; // 1 - No duplicate usernames allowed Classes.cLogin Login = new Classes.cLogin(); Login.CheckForExistingUsername(txtNewUsername.Text); if (Login.MemberID != 0) // UserID is taken { lblSignUpErrors.Text = "This username is already in use. Please select a different one."; } // 2 - Password must meet parameter standards int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(txtPasswordNew.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>" + PasswordValidate.PasswordFailMessage + "."; } else { lblSignUpErrors.Text = PasswordValidate.PasswordFailMessage + "."; } } // 3 - Both passwords must be the same if (txtPasswordNew.Text != txtPasswordNewRetype.Text) //set an error message { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>Passwords don't match. Please re-enter."; } else { lblSignUpErrors.Text = "Passwords don't match. Please re-enter."; } txtPasswordNew.Text = ""; txtPasswordNewRetype.Text = ""; } // 4 - New request - If the email address is already on file, warn them and suggest they go to the Forgot Username / Password section Classes.cLogin ExistingEmailAddress = new Classes.cLogin(); ExistingEmailAddress.GetUsernameByEmail(txtEmail.Text); if (ExistingEmailAddress.Username != "") { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>This email address is already associated with an account. If you've forgotten your username or password, please use the link above."; } else { lblSignUpErrors.Text = "This email address is already associated with an account. If you've forgotten your username or password, please use the link above."; } } // If there were errors, display them and return to form if (lblSignUpErrors.Text != "") { lblSignUpErrors.Visible = true; txtNewUsername.Focus(); } else { // Everything is ok. Create the record. If successful, go to the member demographics screen. Classes.cUser NewUser = new Classes.cUser(txtNewUsername.Text, txtPasswordNew.Text); NewUser.FirstName = txtFirstName.Text; NewUser.LastName = txtLastName.Text; NewUser.LoginPassword = txtPasswordNew.Text; NewUser.LoginEmail = txtEmail.Text; NewUser.LoginName = txtNewUsername.Text; NewUser.Save(); Classes.cLogin Activation = new Classes.cLogin(); Activation.Load(txtNewUsername.Text, txtPasswordNew.Text); string ActivationKey = ""; ActivationKey = Activation.SecurityResetCode; GenerateWelcomeEmail(txtFirstName.Text, txtLastName.Text, txtNewUsername.Text, txtEmail.Text, ActivationKey); Response.Write("<script>"); Response.Write("window.open('NewUserLoginDirections.aspx','_blank')"); Response.Write("</script>"); // TODO-Rick-0e Account for versioning of 'terms of use' and keeping track of date/time and which version user agreed to } } else { // TODO-Rick-3 On create user if something totally unexpected is wrong put up a message } }
protected void Page_Load(object sender, EventArgs e) { // Added to redirect http to https setSecureProtocol(true); // if (!IsPostBack) { // Destroys everything in the session which is essentially what logging out does. Session.Clear(); // TODO-Rick-2 Make the next 7 things visible for real release int HidePublicAccess = 0; // 1 (think of 1 as true) will hide the public access if (HidePublicAccess == 1) { txtNewUsername.Visible = false; txtFirstName.Visible = false; txtLastName.Visible = false; txtEmail.Visible = false; txtPasswordNew.Visible = false; txtPasswordNewRetype.Visible = false; GuestLogin.Text = ""; //LearnMore.Text = ""; lblPasswordReqs.Text = ""; } else { GuestLogin.Text = "<a id=" + "\"" + "lnkGuestLogin" + "\"" + " href=" + "\"" + "PublicCampaigns.aspx" + "\"" + ">Enter LARP Portal as a guest</a>"; //lblPasswordReqs.Text = "<a id=" + "\"" + "PasswordReqs" + "\"" + " href=" + "\"" + "PasswordRequirements.aspx" + "\"" + " target=" + "\"" + "_blank" + "\"" + "><span class=" + "\"" + "glyphicon glyphicon-question-sign" + "\"" + "></span></a>"; lblPasswordReqs.Text = "<span class=" + "\"" + "glyphicon glyphicon-question-sign" + "\"" + "></span>"; } chkTermsOfUse.Visible = false; btnValidateAccount.Visible = false; txtSecurityResetCode.Visible = false; lblSecurityResetCode.Visible = false; lblSignUpErrors.Visible = false; Session["LoginName"] = "Guest"; // Until login changes it Session["UserID"] = 0; // Until login changes it Session["SecurityRole"] = 0; // Until login changes it Session["WebPage"] = "~/General/MemberHome.aspx"; // Until login changes it Session["CurrentPagePermission"] = "True"; // We'll assume that wherever you were last you can still be there when the system takes you there on login lblInvalidLogin.Visible = false; lblInvalidActivationKey.Visible = false; lblInvalidLogin2.Visible = false; string SiteOpsMode; Classes.cLogin OpsMode = new Classes.cLogin(); OpsMode.SetSiteOperationalMode(); SiteOpsMode = OpsMode.SiteOperationalMode; Session["OperationalMode"] = SiteOpsMode; ForgotPassword.Text = "<a id=" + "\"" + "lnkForgotPassword" + "\"" + " href=" + "\"" + "ForgotPassword.aspx" + "\"" + " target=" + "\"" + "_blank" + "\"" + ">Forgot password?</a>"; // Get OS and browser settings and save them to session variables HttpBrowserCapabilities bc = HttpContext.Current.Request.Browser; string UserAgent = HttpContext.Current.Request.UserAgent; Session["IPAddress"] = HttpContext.Current.Request.UserHostAddress; Session["Browser"] = bc.Browser; Session["BrowserVersion"] = bc.Version; Session["Platform"] = bc.Platform; Session["OSVersion"] = Request.UserAgent; // Check for browser. If not Chrome pop message // Chrome for iOS systems shows a browser Sarari but contains "CriOS" in the version in place of the word "Version" //if (bc.Browser != "Chrome" || (bc.Browser == "Safari" && bc.Version.Contains("CriOS") ) ) //{ // string jsString = "alert('LARP Portal is optimized for Chrome. You may experience issues with other browsers.');"; // ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), // "MyApplication", // jsString, // true); //} // } txtName.Visible = false; txtLastLocation.Visible = false; txtLastCharacter.Visible = false; txtLastCampaign.Visible = false; txtUserID.Visible = false; lblPasswordReqs.ToolTip = "LARP Portal login passwords must be at least 7 characters long and contain at least " + "1 uppercase letter, 1 lowercse letter, 1 number and 1 special character"; if (!IsPostBack) { txtUserName.Attributes.Add("Placeholder", "Username"); txtUserName.Focus(); txtPassword.Attributes.Add("Placeholder", "Password"); txtEmail.Attributes.Add("Placeholder", "Email"); txtNewUsername.Attributes.Add("Placeholder", "Username"); txtFirstName.Attributes.Add("Placeholder", "First Name"); txtLastName.Attributes.Add("Placeholder", "Last Name"); txtPasswordNew.Attributes.Add("Placeholder", "Password"); txtPasswordNewRetype.Attributes.Add("Placeholder", "Retype Password"); btnSignUp.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { HttpContext context = HttpContext.Current; if (context.Request.Url.AbsoluteUri.ToUpper().Contains("BETA")) // ) || (context.Request.IsLocal)) { // MainBody.Attributes.Add("bgcolor", "LightCyan"); MainBody.Attributes.Add("style", "background-color: LightCyan"); } if (!IsPostBack) { if (Session["CurrentPagePermission"].ToString() == "False") { if (Session["AlternatePageURL"] != null) { string AltURL = Session["AlternatePageURL"].ToString(); Session["CurrentPagePermission"] = "True"; Session["LastLoggedInLocation"] = AltURL; //Response.Redirect(AltURL); Rick - 10/11/2015 - Remove comment when security works } } string PageName = Request.Url.AbsolutePath + ".aspx"; Session["LastLoggedInLocation"] = PageName; if (Session["LastWrittenLoggedInLocation"] != null && Session["LastWrittenLoggedInLocation"] == Session["LastLoggedInLocation"]) { // Do nothing } else { int ExclusionCount = 0; if (Session["ExclusionCount"] == null) { Session["ExclusionCount"] = 0; } if (Session["PageName"] == null) { Session["PageName"] = PageName; } else { if (Session["PageName"] == PageName) { Int32.TryParse(Session["ExclusionCount"].ToString(), out ExclusionCount); } else { string lsRoutineName = "LARPortal.Master.PageNameContainCheck"; string stStoredProc = "uspCheckForExclusion"; string strUserName = Session["UserName"].ToString(); SortedList slParams = new SortedList(); slParams.Add("@CompareString", PageName); slParams.Add("@ExclusionType", "LastLoggedInLocation"); DataTable dtExclusionCheck = cUtilities.LoadDataTable(stStoredProc, slParams, "LARPortal", strUserName, lsRoutineName); foreach (DataRow dRow in dtExclusionCheck.Rows) { Int32.TryParse(dRow["Exclude"].ToString(), out ExclusionCount); } } } //if (PageName.Contains("Error") || PageName.Contains("WhatsNewDetail") || PageName.Contains("Reports/") || PageName.Contains("EventPayment") || PageName.Contains("PageUnderConstruction")) if (ExclusionCount > 0) { // It met at least one exclusion criteria. Do nothing. } else { // Set them equal and write to MDBUser LastLoggedInLocation Session["LastWrittenLoggedInLocation"] = Session["LastLoggedInLocation"]; Classes.cLogin LastLoggedIn = new Classes.cLogin(); if (Session["UserID"] != null) { int intUserID = Session["UserID"].ToString().ToInt32(); LastLoggedIn.LogLastPage(intUserID, PageName); } } } // Check page security // Check request.rawurl against cURLPermission // Go get all roles for that campaign and load them into a session variable int UserID = Convert.ToInt32(Session["UserID"]); int CampaignID = Convert.ToInt32(Session["CampaignID"]); Classes.cPlayerRoles Roles = new Classes.cPlayerRoles(); Roles.Load(UserID, 0, CampaignID, DateTime.Today); Session["PlayerRoleString"] = Roles.PlayerRoleString; Classes.cURLPermission permissions = new Classes.cURLPermission(); bool PagePermission = true; string DefaultUnauthorizedURL = ""; permissions.GetURLPermissions(Request.RawUrl, UserID, Roles.PlayerRoleString); PagePermission = permissions._PagePermission; DefaultUnauthorizedURL = permissions._DefaultUnauthorizedURL; if (PagePermission == false) { Response.Redirect(DefaultUnauthorizedURL); } // End permission check } // Uncomment this if trying to run the page without going through the index.aspx page //Session["SecurityRole"] = 0; int i; int intSecurityRole; if (Session["CampaignName"] == null) { Session["CampaignName"] = ""; } //lblCampaignName.Text = Session["CampaignName"].ToString(); if (Session["LoginName"] == null) { Session["LoginName"] = "Guest"; } //lblLoginName.Text = "Welcome " + Session["LoginName"].ToString(); if (int.TryParse(Session["SecurityRole"].ToString(), out i)) { intSecurityRole = i; } else { intSecurityRole = 0; } LoadMainLinks(); LoadTopTab(intSecurityRole, 0); //TODO-Rick-2 Change second variable to a session variable as defined by Jeff's communications section LoadPageFooter(); if (Session["PageFooter"] == null) { Session["PageFooter"] = " "; } lblPageFooter.Text = Session["PageFooter"].ToString(); }