Example #1
0
        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());
                    }
                }
            }
        }
Example #2
0
        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);
                }
            }
        }