Ejemplo n.º 1
0
/*
 */
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            classes.Login clsLogin = new classes.Login();
            if (clsLogin.DoLogin(txtUsername.Text, txtPassword.Text, true, false))
            {
                pnlLoginMsg.Visible = false;
                pnlLogin.Visible    = false;

                dlCommentList.Visible = true;
                pnlCommentBox.Visible = true;

                hndUserId.Value = Session["UserId"].ToString();
                btnPostComment.Attributes.Add("OnClick", "if(CheckComment()==false){alert('Type in your answer first.');event.returnValue=false;return false;}else{return true;}");

                //Get text for login links
                lnkSignIn.Text = Global.SetLnkSignIn();
                lnkSignUp.Text = Global.SetLnkSignUp();

                lblLogin.Text = string.Empty;
            }
            //login failed
            else
            {
                //TODO: display correct failure message
                lblMessage.Text = "Login Failed.  Please try again.";
            }
            LoadAnswers();
        }
Ejemplo n.º 2
0
        /*
         */
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            classes.Login clsLogin = new classes.Login();
            if (clsLogin.DoLogin(txtUsername.Text, txtPassword.Text, true, false))
            {
                BindComments();

                dlCommentList.Visible = true;
                pnlCommentBox.Visible = true;

                //Get text for login links
                lnkSignIn.Text = Global.SetLnkSignIn();
                lnkSignUp.Text = Global.SetLnkSignUp();

                lblWallMessage.Text = "Write a comment below";

                btnNudge.Visible  = true;
                btnNudge.Enabled  = true;
                btnNudge.CssClass = "Tips btnNext";
            }
            //login failed
            else
            {
                lblWallMessage.Text      = "Wrong username or password.&nbsp;&nbsp;<a id='toggle2' class='orange_orange14u' href='#'>Login&nbsp;again.</a>";
                lblWallMessage.ForeColor = Color.Red;
                //Response.Redirect(Request.Url.ToString(), false);
            }
        }
Ejemplo n.º 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            hasError = false;
            if (string.IsNullOrEmpty(txtUsername.Text) || txtUsername.Text == "Username")
            {
                hasError = true;
                MessageBox.Show("Please enter your username.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUsername.Focus();
                return;
            }
            else
            {
                if (string.IsNullOrEmpty(txtPassword.Text) || txtPassword.Text == "Password")
                {
                    hasError = true;
                    MessageBox.Show("Please enter your password.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPassword.Text = "";
                    txtPassword.Focus();
                    return;
                }
                else
                {
                    if (hasError == false)
                    {
                        login          = new classes.Login();
                        login.username = txtUsername.Text;
                        login.password = txtPassword.Text;

                        if (login.login())
                        {
                            if (login.active_account())
                            {
                            }
                            else
                            {
                                register.username = txtUsername.Text;
                                MessageBox.Show("Your account is currently in-active.\nTo continue, please set-up your new password.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                Final.frmLogin.instance.Controls["panelContainer"].Controls["ucRegister1"].Visible        = false;
                                Final.frmLogin.instance.Controls["panelContainer"].Controls["ucLogin1"].Visible           = false;
                                Final.frmLogin.instance.Controls["panelContainer"].Controls["ucActivateAccount1"].Visible = true;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Incorrect username or password.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            txtPassword.Text = "";
                            txtPassword.Focus();
                            return;
                        }
                    }
                    else
                    {
                    }
                }
            }
        }
Ejemplo n.º 4
0
/*
 */
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            classes.Login clsLogin = new classes.Login();
            if (clsLogin.DoLogin(txtUsername.Text, txtPassword.Text, true, false))
            {
                BindComments();

                dlCommentList.Visible = true;
                pnlCommentBox.Visible = true;

                //Get text for login links
                lnkSignIn.Text = Global.SetLnkSignIn();
                lnkSignUp.Text = Global.SetLnkSignUp();
            }
            //login failed
            else
            {
                //TODO: need error msg
                Response.Redirect(Request.Url.ToString(), false);
            }
        }