Exemple #1
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {

            if (!String.IsNullOrEmpty(txtPwd.Text))
            {
                byte[] pwd = Encoding.UTF8.GetBytes(txtPwd.Text);

                returnEncoded = Convert.ToBase64String(pwd);
            }

            LoginManagement lg = new LoginManagement();

            lg.getRegisterParams("@user", txtUsr.Text);
            lg.getRegisterParams("@pw", returnEncoded);
            lg.getRegisterParams("@email", txtEmail.Text);

            if (lg.doRegister(getCon) == true)
            {
                Label4.Text = "Register successful. Redirecting to Login in 3 seconds.";
                Thread.Sleep(3000);
                Response.Redirect("~/Login.aspx");
            }

            else
            {
                Label4.Text = "Error occurred.";
            }
        }
Exemple #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPwd.Text))
            {
                byte[] pwd = Encoding.UTF8.GetBytes(txtPwd.Text);

                returnEncoded = Convert.ToBase64String(pwd);
            }

            LoginManagement lg = new LoginManagement();

            lg.getLoginParams("@user", txtUsr.Text);
            lg.getLoginParams("@pw", returnEncoded);

            if (lg.doLogin(getCon) == true)
            {
                Session["username"] = txtUsr.Text;
                Response.Redirect("~/Main.aspx");
            }

            else
            {
                Label2.Text = "Error occurred.";
            }

        }
Exemple #3
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {

            if (!String.IsNullOrEmpty(txtPwd.Text))
            {
                byte[] pwd = Encoding.UTF8.GetBytes(txtPwd.Text);

                returnEncoded = Convert.ToBase64String(pwd);
            }

            LoginManagement lg = new LoginManagement();

            lg.getRegisterParams("@user", txtUsr.Text);
            lg.getRegisterParams("@pw", returnEncoded);
            lg.getRegisterParams("@email", txtEmail.Text);

            try
            {
                FriendManagement fm = new FriendManagement();

                fm.grabIDParams("@username", txtUsr.Text);

                int getID = fm.grabID(getCon);

                if (getID != 0)
                {
                    Label4.Visible = true;
                    Label4.Text = "User exists.";
                    return;
                }

            }
            catch (Exception ex)
            {
                //continue
            }

            if (lg.doRegister(getCon) == true)
            {
                Label4.Visible = true;
                Label4.Text = "Register successful. Redirecting to Login in 3 seconds.";
                Thread.Sleep(3000);
                Response.Redirect("~/Login.aspx");
            }

            else
            {
                Label4.Visible = true;
                Label4.Text = "Error occurred.";
            }

        }