Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!ClsAuth.IsUser())
        {
            this.msg.Text = "Not a valid user.";
            return;
        }
        string ID = Session["userid"].ToString();

        if (this.IsPostBack)
        {
            try
            {
                this.msg.Text = "";
                this.retrieveRequest();
                this.retrieveDB(ID);
                //Response.Write(this.db_old_pwd_hash + "=?=" + this.old_pwd );

                if (this.db_old_pwd_hash != this.old_pwd)
                {
                    this.msg.Text = "<p><font color='red'>Invalid old password.</font></p>";
                }
                else
                {
                    string check = ClsUser.validate_pwd(this.new_pwd, this.new_pwd2);
                    if (check != "")
                    {
                        this.msg.Text = "<p><font color='red'>" + check + ".</font></p>";
                    }
                    else
                    {
                        this.update(ID);
                        this.msg.Text = "<p><font color='green'>Your password has been updated.</font> </p>";
                    }
                }
            }
            catch (Exception ex)
            {
                this.msg.Text = "<p><font color='red'>" + ex.Message + "</font></p>";
            }
        }
        else
        {
            this.msg.Text = "";
        }
    }
Example #2
0
    public string check_error()
    {
        string s = "";

        if (this.user.first_name == "")
        {
            s += "First name cannot be empty<br>";
        }

        if (this.user.last_name == "")
        {
            s += "Last name cannot be empty<br>";
        }

        if (!ClsUtil.IsValidEmail(this.user.email))
        {
            s += "Email is not valid<br>";
        }

        if (this.user.login == "")
        {
            s += "Login cannot be empty<br>";
        }

        string t = ClsUser.validate_pwd(ClsUtil.getPostVal(Request["txtPwd"]), ClsUtil.getPostVal(Request["txtPwd2"]));

        if (t != "")
        {
            s += t + "<br>";
        }

        if (this.user.gid == "")
        {
            s += "User Type cannot be empty<br>";
        }

        return(s);
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ClsAuth.check_auth_admin();

        string ID = ClsUtil.getStrVal(Request["id"]);

        this.user.retrieveDB(ID);
        this.lblProfile.Text = this.ShowViewForm();

        if (this.IsPostBack)
        {
            try {
                this.msg.Text = "";
                this.retrievePostVal();
                //Response.Write(this.db_old_pwd_hash + "=?=" + this.old_pwd );

                string check = ClsUser.validate_pwd(this.new_pwd, this.new_pwd2);
                if (check != "")
                {
                    this.msg.Text = "<p><font color='red'>" + check + ".</font></p>";
                }
                else
                {
                    this.update(ID);
                    this.msg.Text = "<p><font color='green'>User password has been updated.</font> </p>";
                }
            }
            catch (Exception ex) {
                this.msg.Text = "<p><font color='red'>" + ex.Message + "</font></p>";
            }
        }
        else
        {
            this.msg.Text = "";
        }
    }