Преглед на файлове

Only add password to the form post if not null or empty

LukePulverenti Luke Pulverenti luke pulverenti преди 12 години
родител
ревизия
90c609c159
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      MediaBrowser.ApiInteraction/ApiClient.cs

+ 6 - 1
MediaBrowser.ApiInteraction/ApiClient.cs

@@ -353,7 +353,12 @@ namespace MediaBrowser.ApiInteraction
             string url = ApiUrl + "/UserAuthentication?dataformat=" + SerializationFormat.ToString();
 
             // Create the post body
-            string postContent = string.Format("userid={0}&password={1}", userId, password);
+            string postContent = string.Format("userid={0}", userId);
+
+            if (!string.IsNullOrEmpty(password))
+            {
+                postContent += "&password=" + password;
+            }
 
             HttpContent content = new StringContent(postContent, Encoding.UTF8, "application/x-www-form-urlencoded");