Beispiel #1
0
        protected void btn_Click(object sender, EventArgs e)
        {
            clsJP_ADMINFactory fac  = new clsJP_ADMINFactory();
            List <clsJP_ADMIN> User = fac.GetAllBy(clsJP_ADMIN.clsJP_ADMINFields.Username, txtUserName.Text);
            Helper             h    = new Helper();

            if (User != null && User.Count > 0)
            {
                string Decrypt = h.Decrypt(User[0].Pswd);

                if (User[0].Pswd == h.Encrypt(txtPassword.Text))
                {
                    Session["User"] = User[0];
                    Response.Redirect("Songs.aspx");
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "Password is not correct";
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = "UserName is not correct";
            }
        }
Beispiel #2
0
        protected void btn_Click(object sender, EventArgs e)
        {
            clsJP_ADMIN        U    = (clsJP_ADMIN)Session["User"];
            clsJP_ADMINFactory fac  = new clsJP_ADMINFactory();
            List <clsJP_ADMIN> User = fac.GetAllBy(clsJP_ADMIN.clsJP_ADMINFields.Username, U.Username);

            Helper h = new Helper();

            if (User != null && User.Count > 0)
            {
                if (User[0].Pswd == h.Encrypt(txtOld.Text))
                {
                    clsJP_ADMIN NewUser = new clsJP_ADMIN();
                    NewUser.Username = U.Username;
                    NewUser.Pswd     = h.Encrypt(txtNew.Text);

                    fac.Update(NewUser);
                    pnlSuccess.Visible = true;
                }
                else
                {
                    pnlError.Visible = true;
                }
            }
        }