public static string DeleteUser(string username) { SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandText = "delete from dbo.Users where username ='******'"; string res = ClassMain.strExecuteComand(sqlCmd); return(res); }
public static string ChangePassword(string username, string password) { // EnCryptPassword string salt = System.Configuration.ConfigurationManager.AppSettings["salt"]; string strEnCrypt = SHA256.EcryptPassword(password, salt); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandText = "update dbo.Users set Password = '******' where username =LOWER('" + username + "')"; string res = ClassMain.strExecuteComand(sqlCmd); return(res); }
protected void btnReset_Click(object sender, EventArgs e) { // EnCryptPassword string salt = System.Configuration.ConfigurationManager.AppSettings["salt"]; string strEnCrypt = SHA256.EcryptPassword(inputPassword.Text, salt); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandText = "update dbo.Users set Password = '******' where Username ='******'"; string res = ClassMain.strExecuteComand(sqlCmd); if (res != "") { lblResult.Text = res; } else { lblResult.Text = "Update success."; lblResult.Visible = true; } }