Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int UserID = 0;

            if (Session["UserID"] != null)
            {
                int.TryParse(Session["UserID"].ToString(), out UserID);
            }
            Classes.cLogin FirstCampaignWelcome = new Classes.cLogin();
            FirstCampaignWelcome.getFirstCampaignWelcome();
            lblWelcome.Text = FirstCampaignWelcome.FirstCampaignWelcomeText;
            ReloadtvCampaign(UserID);
        }
Esempio n. 2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Classes.cUser   Demography   = new Classes.cUser(Master.UserName, "Password", Session.SessionID);
                Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);
                Classes.cLogin  UserLoggedIn = new Classes.cLogin();
                UserLoggedIn.ValidateUserForPasswordReset(Master.UserName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName);

                hidOrigPassword.Value = UserLoggedIn.Password;

                tbAnswer1.Text = UserLoggedIn.SecurityAnswer1;
                tbAnswer2.Text = UserLoggedIn.SecurityAnswer2;
                tbAnswer3.Text = UserLoggedIn.SecurityAnswer3;

                tbQuestion1.Text = UserLoggedIn.SecurityQuestion1;
                tbQuestion2.Text = UserLoggedIn.SecurityQuestion2;
                tbQuestion3.Text = UserLoggedIn.SecurityQuestion3;
            }
        }
Esempio n. 3
0
        protected void btnSaveProfile_Click(object sender, EventArgs e)
        {
            cUser   Demography   = new Classes.cUser(Master.UserName, "Password", Session.SessionID);
            cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);

            Demography.FirstName               = tbFirstName.Text.Trim();
            Demography.MiddleName              = tbMiddleName.Text.Trim();
            Demography.LastName                = tbLastName.Text.Trim();
            Demography.NickName                = tbNickName.Text;
            Demography.ForumUserName           = tbForumName.Text.Trim();
            PLDemography.EmergencyContactName  = tbEmergencyName.Text.Trim();
            PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text.Trim();

            if (ddlGender.SelectedIndex != -1)
            {
                PLDemography.GenderStandared = ddlGender.SelectedValue;
            }

            PLDemography.GenderOther = tbGenderOther.Text;

            if (string.IsNullOrWhiteSpace(tbUserName.Text)) //If left empty set back to original setting...They may not remember it....
            {
                tbUserName.Text = Demography.LoginName;
            }

            // 1 - No duplicate usernames allowed
            Classes.cLogin Login = new Classes.cLogin();
            Login.CheckForExistingUsername(tbUserName.Text);
            if (Login.MemberID != 0 && Login.MemberID != Demography.UserID)  // UserID is taken
            {
                lblMessage.Text = "This username is already in use.  Please select a different one.";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbUserName.Focus();
                return;
            }
            else
            {
                Demography.LoginName = tbUserName.Text.Trim();
            }

            DateTime dtDOB;

            if (DateTime.TryParse(tbBDMM.Value + "/" + tbBDDD.Value + "/" + tbBDYYYY.Value, out dtDOB))
            {
                PLDemography.DateOfBirth = dtDOB;
            }
            else
            {
                lblMessage.Text = "Please enter a valid date";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbBDMM.Focus();
                return;
            }

            PLDemography.AuthorName  = tbPenName.Text;
            Demography.ForumUserName = tbForumName.Text;

            PLDemography.EmergencyContactName = tbEmergencyName.Text;

            if (!cPhone.isValidPhoneNumber(tbEmergencyPhone.Text, 10))
            {
                lblMessage.Text = cPhone.ErrorDescription;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbEmergencyPhone.Focus();
                return;
            }
            else
            {
                PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text;
            }

            PLDemography.PictureID = -1;

            if (ViewState["UserIDPicture"] != null)
            {
                int iTemp;
                if (int.TryParse(ViewState["UserIDPicture"].ToString(), out iTemp))
                {
                    PLDemography.PictureID = iTemp;
                }
                else
                {
                    PLDemography.PictureID = -1;
                }
                //PLDemography.UserPhoto = Session["dem_Img_Url"].ToString();
                //imgPlayerImage.ImageUrl = Session["dem_Img_Url"].ToString();
                //Session["dem_Img_Url"] = "";
                //Session.Remove("dem_Img_Id");

                //Classes.cPicture NewPicture = new Classes.cPicture();
                //int iPictureId =0;
                //if (Session["dem_Img_Id"] != null && Int32.TryParse(Session["dem_Img_Id"].ToString(), out iPictureId))
                //{
                //    //This code will be enabled once the stored procedure is created
                //    string userID = Session["UserID"].ToString();
                //    //NewPicture.Load(iPictureId, userID);
                //    //NewPicture.PictureFileName = NewPicture.PictureFileName.Replace("_2", "_1");
                //    //NewPicture.Save(userID);
                //    //Time to trash the old main picture with the picture in memory
                //    //PLDemography.UserPhoto = NewPicture.PictureFileName;
                //}
            }
            else
            {
                PLDemography.PictureID = -1;
            }

            Demography.Save();
            PLDemography.Save();
            //Session["Username"] = Demography.LoginName;

            lblMessage.Text = "Changes saved successfully.";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        }
Esempio n. 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            divErrorPasswords.Visible = false;
            divErrorQuestion1.Visible = false;
            divErrorQuestion2.Visible = false;
            divErrorQuestion3.Visible = false;

            if ((!hidOrigPassword.Value.Equals(tbOrigPassword.Text)) &&
                (tbOrigPassword.Text.Length > 0))
            {
                lblErrorPasswords.Text    = "The original password is incorrect.";
                divErrorPasswords.Visible = true;
                return;
            }

            if ((tbOrigPassword.Text.Length == 0) &&
                ((tbPassword.Text.Length > 0) ||
                 (tbPasswordConfirm.Text.Length > 0)))
            {
                lblErrorPasswords.Text    = "If you want to change your password you must enter the original password.";
                divErrorPasswords.Visible = true;
                return;
            }

            if (!tbPassword.Text.Equals(tbPasswordConfirm.Text))
            {
                lblErrorPasswords.Text    = "The new passwords must be the same.";
                divErrorPasswords.Visible = true;
                return;
            }

            Classes.cUser   Demography   = new Classes.cUser(Master.UserName, "Password", Session.SessionID);
            Classes.cPlayer PLDemography = new Classes.cPlayer(Master.UserID, Master.UserName);
            Classes.cLogin  UserLoggedIn = new Classes.cLogin();
            //this needs to be done in order to show security questions as per ForgotPassword existing logic
            UserLoggedIn.ValidateUserForPasswordReset(Master.UserName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName);

            //Validate password
            if (!string.IsNullOrWhiteSpace(tbPassword.Text))
            {
                UserLoggedIn.ValidateNewPassword(tbPassword.Text);
                if (UserLoggedIn.PasswordValidation == 0)
                {
                    lblErrorPasswords.Text    = UserLoggedIn.PasswordFailMessage;
                    divErrorQuestion1.Visible = true;
                    return;
                }
            }

            if ((string.IsNullOrWhiteSpace(tbQuestion1.Text)) ||
                (string.IsNullOrWhiteSpace(tbAnswer1.Text)))
            {
                lblErrorQuestion1.Text    = "Question 1 and Answer 1 are required.";
                divErrorQuestion1.Visible = true;
                tbQuestion1.Focus();
                return;
            }


            //If question entered and answer not entered
            if (!string.IsNullOrWhiteSpace(tbQuestion2.Text) && string.IsNullOrWhiteSpace(tbAnswer2.Text))
            {
                lblErrorQuestion2.Text = "If you enter question 2 you must enter the answer also.";
                lblErrorQuestion2.Focus();
                divErrorQuestion2.Visible = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(tbQuestion2.Text) && !string.IsNullOrWhiteSpace(tbAnswer2.Text))
            {
                lblErrorQuestion2.Text = "If you enter answer 2 you must enter the question also.";
                lblErrorQuestion2.Focus();
                divErrorQuestion2.Visible = true;
                return;
            }

            //If question entered and answer not entered
            if (!string.IsNullOrWhiteSpace(tbQuestion3.Text) && string.IsNullOrWhiteSpace(tbAnswer3.Text))
            {
                lblErrorQuestion3.Text = "If you enter question 3 you must enter the answer also.";
                lblErrorQuestion3.Focus();
                divErrorQuestion3.Visible = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(tbQuestion3.Text) && !string.IsNullOrWhiteSpace(tbAnswer3.Text))
            {
                lblErrorQuestion3.Text = "If you enter answer 3 you must enter the question also.";
                lblErrorQuestion3.Focus();
                divErrorQuestion3.Visible = true;
                return;
            }


            //Make sure that questions and answers do not repeat

            UserLoggedIn.UpdateQAandPassword(
                UserLoggedIn.UserSecurityID,
                Master.UserID,
                tbQuestion1.Text, "1",
                tbQuestion2.Text, "1",
                tbQuestion3.Text, "1",
                tbAnswer1.Text, "1",
                tbAnswer2.Text, "1",
                tbAnswer3.Text, "1",
                string.IsNullOrWhiteSpace(tbPassword.Text) ? UserLoggedIn.Password : tbPassword.Text);

            lblErrorPasswords.Text = "Changes saved successfully.";
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtPassword.Attributes.Add("PlaceHolder", "Password");
            txtPassword2.Attributes.Add("PlaceHolder", "Password");
            txtSecurityQuestion1.Attributes.Add("PlaceHolder", "Enter your security question 1");
            txtSecurityAnswer1.Attributes.Add("PlaceHolder", "Enter your security answer 1");
            txtSecurityQuestion2.Attributes.Add("PlaceHolder", "Enter your security question 2");
            txtSecurityAnswer2.Attributes.Add("PlaceHolder", "Enter your security answer 2");
            txtSecurityQuestion3.Attributes.Add("PlaceHolder", "Enter your security question 3");
            txtSecurityAnswer3.Attributes.Add("PlaceHolder", "Enter your security answer 3");

            lblError.Text           = string.Empty;
            lblErrorQuestions.Text  = string.Empty;
            lblErrorQuestion2.Text  = string.Empty;
            lblErrorQuestion3.Text  = string.Empty;
            lblPasswordReqs.Text    = "<span class=" + "\"" + "glyphicon glyphicon-question-sign" + "\"" + "></span>";
            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 (Session["Username"] == null)
            {
                btnSave.Visible = false;
                return;
            }

            Session["ActiveLeftNav"] = "Security";
            uName = "";
            uID   = 0;
            if (Session["Username"] != null)
            {
                uName = Session["Username"].ToString();
            }
            if (Session["UserID"] != null)
            {
                uID = (Session["UserID"].ToString().ToInt32());
            }
            //This method is not loading my email so nothing works
            Demography   = new Classes.cUser(uName, "Password");
            PLDemography = new Classes.cPlayer(uID, uName);
            UserLoggedIn = new Classes.cLogin();
            //this needs to be done in order to show security questions as per ForgotPassword existing logic
            UserLoggedIn.ValidateUserForPasswordReset(uName, Demography.PrimaryEmailAddress.EmailAddress, Demography.LastName);

            if (IsPostBack == false)
            {
                txtUsername.Text  = uName;
                txtFirstName.Text = Demography.FirstName;
                if (Demography.MiddleName.Length > 0)
                {
                    txtMI.Text = Demography.MiddleName.Substring(0, 1);
                }
                txtLastName.Text = Demography.LastName;
                txtNickName.Text = Demography.NickName;


                if (string.IsNullOrWhiteSpace(Demography.PrimaryEmailAddress.EmailAddress))
                {
                    lblError.Text = "Primary email must be setup first";
                    return;
                }

                txtSecurityAnswer1.Text = UserLoggedIn.SecurityAnswer1;
                txtSecurityAnswer2.Text = UserLoggedIn.SecurityAnswer2;
                txtSecurityAnswer3.Text = UserLoggedIn.SecurityAnswer3;

                txtSecurityQuestion1.Text = UserLoggedIn.SecurityQuestion1;
                txtSecurityQuestion2.Text = UserLoggedIn.SecurityQuestion2;
                txtSecurityQuestion3.Text = UserLoggedIn.SecurityQuestion3;
            }
        }
Esempio n. 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            cUser   Demography   = new Classes.cUser(_UserName, "Password");
            cPlayer PLDemography = new Classes.cPlayer(_UserID, _UserName);

            if (!string.IsNullOrWhiteSpace(tbFirstName.Text))
            {
                Demography.FirstName = tbFirstName.Text.Trim();
            }

            Demography.MiddleName = tbMiddleInit.Text.Trim(); //I should be able to remove my middle initial if I want

            if (!string.IsNullOrWhiteSpace(tbLastName.Text))
            {
                Demography.LastName = tbLastName.Text.Trim();
            }

            if (ddlGender.SelectedIndex != -1)
            {
                PLDemography.GenderStandared = ddlGender.SelectedValue;
            }

            PLDemography.GenderOther = tbGenderOther.Text; //We shall trust this value since the select event clears the text when needed

            Demography.NickName = tbNickName.Text;

            if (string.IsNullOrWhiteSpace(tbUserName.Text)) //If left empty set back to original setting...They may not remember it....
            {
                tbUserName.Text = Demography.LoginName;
            }

            // 1 - No duplicate usernames allowed
            Classes.cLogin Login = new Classes.cLogin();
            Login.CheckForExistingUsername(tbUserName.Text);
            if (Login.MemberID != 0 && Login.MemberID != Demography.UserID)  // UserID is taken
            {
                lblMessage.Text = "This username is already in use.  Please select a different one.";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbUserName.Focus();
                return;
            }
            else
            {
                Demography.LoginName = tbUserName.Text.Trim();
            }

            DateTime dob;

            if (DateTime.TryParse(tbDOB.Text, out dob))
            {
                PLDemography.DateOfBirth = dob;
            }
            else
            {
                lblMessage.Text = "Please enter a valid date";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbDOB.Focus();
                return;
            }

            PLDemography.AuthorName  = tbPenName.Text;
            Demography.ForumUserName = tbForumName.Text;

            PLDemography.EmergencyContactName = tbEmergencyName.Text;

            // Using the inital records merge result with the new ones.
            //if (AddressesChangesValidate() == false)
            //    return;

            //if (PhoneNumbersChangesValidate() == false)
            //    return;

            //if (EmailsChangesValidate() == false)
            //    return;

            if (!cPhone.isValidPhoneNumber(tbEmergencyPhone.Text, 10))
            {
                lblMessage.Text = cPhone.ErrorDescription;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                tbEmergencyPhone.Focus();
                return;
            }
            else
            {
                PLDemography.EmergencyContactPhone = tbEmergencyPhone.Text;
            }

            /* 3) handle picture update/add.
             */

            //At this point all validation must have been done so it is time to merge lists
            // AddressesChangesUpdate(Demography);
            // PhonesChangesUpdate(Demography);
            // EmailsChangesUpdate(Demography);

            PLDemography.PictureID = -1;

            if (ViewState["UserIDPicture"] != null)
            {
                int iTemp;
                if (int.TryParse(ViewState["UserIDPicture"].ToString(), out iTemp))
                {
                    PLDemography.PictureID = iTemp;
                }
                else
                {
                    PLDemography.PictureID = -1;
                }
                //PLDemography.UserPhoto = Session["dem_Img_Url"].ToString();
                //imgPlayerImage.ImageUrl = Session["dem_Img_Url"].ToString();
                //Session["dem_Img_Url"] = "";
                //Session.Remove("dem_Img_Id");

                //Classes.cPicture NewPicture = new Classes.cPicture();
                //int iPictureId =0;
                //if (Session["dem_Img_Id"] != null && Int32.TryParse(Session["dem_Img_Id"].ToString(), out iPictureId))
                //{
                //    //This code will be enabled once the stored procedure is created
                //    string userID = Session["UserID"].ToString();
                //    //NewPicture.Load(iPictureId, userID);
                //    //NewPicture.PictureFileName = NewPicture.PictureFileName.Replace("_2", "_1");
                //    //NewPicture.Save(userID);
                //    //Time to trash the old main picture with the picture in memory
                //    //PLDemography.UserPhoto = NewPicture.PictureFileName;
                //}
            }
            else
            {
                PLDemography.PictureID = -1;
            }

            Demography.Save();
            PLDemography.Save();
            Session["Username"] = Demography.LoginName;

            lblMessage.Text = "Changes saved successfully.";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        }