protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtUsername.Text != "" && txtOldPassword.Text != "" && txtNewPassword.Text != "" && txtConfirmpass.Text != "")
        {
            DataTable dt              = new DataTable();
            string    username        = txtUsername.Text.Trim();
            string    oldpassword     = txtOldPassword.Text.Trim();
            string    newpassword     = txtNewPassword.Text.Trim();
            string    confirmpassword = txtConfirmpass.Text.Trim();

            if (local_login.IfUserPassExists(username, oldpassword, "N", "") == "T")
            {
                dt = local_login.getdataLogin(username);
                string loginid = Convert.ToString(dt.Rows[0]["LoginID"]);

                local_login.UpdatePassword(newpassword, loginid);
                clear();
                mpe.Show();
                lblpopup.Text           = "Your Password Changed";
                lbla.Visible            = false;
                txtwalletamount.Visible = false;
                Addwallet.Visible       = false;
                //lblMessage.ForeColor = Color.Green;
                //lblMessage.Text = "Your Password Changed";
            }
            else
            {
                mpe.Show();
                lblpopup.Text           = "Invalid Username/Password";
                lbla.Visible            = false;
                txtwalletamount.Visible = false;
                Addwallet.Visible       = false;
                //lblMessage.ForeColor = Color.Red;
                //lblMessage.Text = "Username/Password Invalid";
            }
        }
        else
        {
            mpe.Show();
            lblpopup.Text           = "Please fill the user mobile nubmer <br/>or email-id and password";
            lbla.Visible            = false;
            txtwalletamount.Visible = false;
            Addwallet.Visible       = false;
            //Response.Write("<script> alert('Fill User Email-ID and Password'); </script>");
        }
    }
Example #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        try
        {
            string mobileno = txtMobileno.Text.Trim();
            dt = local_login.getUserDataforgotpassword(mobileno);
            if (dt.Rows.Count > 0)
            {
                string loginid  = dt.Rows[0]["LoginID"].ToString();
                string userid   = dt.Rows[0]["UserId"].ToString();
                string username = dt.Rows[0]["UserName"].ToString();
                Session["usermailid"] = username;
                string newpassword = GenRandomCode(7);
                Session["newpassword"] = newpassword;
                int result = 0;

                result = local_login.UpdatePassword(newpassword, loginid);
                if (result != 0)
                {
                    SendPassword();
                    mpe.Show();
                    lblError.ForeColor = Color.Green;
                    lblError.Text      = "Your password has been changed<br/>and send on your mail id.";
                    clear();
                }
            }
            else
            {
                lblMessage2.ForeColor = Color.Red;
                lblMessage2.Text      = "Invalid Mobile Number!";
            }
        }
        catch (Exception ex)
        {
            lblMessage2.ForeColor = Color.Red;
            lblMessage2.Text      = ex.Message;
        }
    }