//Metodo que se llama una vez se valide todo, y se realiza el cambio de contraseƱa public void modificarPassword(NewPasswordValidator np) { string encriptedPassword = GetSha256(np.newpassword); string StrConn = ConfigurationManager.ConnectionStrings["BDLocal"].ToString(); using (SqlConnection conn = new SqlConnection(StrConn)) { conn.Open(); SqlCommand comm = new SqlCommand("modificarPassword", conn); comm.CommandType = System.Data.CommandType.StoredProcedure; comm.Parameters.Add(new SqlParameter("@password", encriptedPassword)); comm.Parameters.Add(new SqlParameter("@email", np.email)); SqlDataReader dr = comm.ExecuteReader(); } }
//Metodo para validar el token ingresado en el formulario de cambio de contraseƱa con el token que esta en la BD public bool validarTokenEmail(NewPasswordValidator np) { string strConn = ConfigurationManager.ConnectionStrings["BDLocal"].ToString(); bool result = false; using (SqlConnection conn = new SqlConnection(strConn)) { conn.Open(); SqlCommand comm = new SqlCommand("validarTokenEmail", conn); comm.CommandType = System.Data.CommandType.StoredProcedure; comm.Parameters.Add(new SqlParameter("@email", np.email)); comm.Parameters.Add(new SqlParameter("@token", np.token)); SqlDataReader reader = comm.ExecuteReader(); if (reader.HasRows) { result = true; } } return(result); }