diff options
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/ApiService.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs | 28 | ||||
| -rw-r--r-- | MediaBrowser.Api/MediaBrowser.Api.csproj | 1 | ||||
| -rw-r--r-- | MediaBrowser.Api/Plugin.cs | 4 |
4 files changed, 35 insertions, 1 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index 5ff1b8949a..c830b7efcf 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -292,7 +292,8 @@ namespace MediaBrowser.Api {
Id = user.Id,
Name = user.Name,
- HasImage = !string.IsNullOrEmpty(user.PrimaryImagePath)
+ HasImage = !string.IsNullOrEmpty(user.PrimaryImagePath),
+ HasPassword = !string.IsNullOrEmpty(user.Password)
};
}
}
diff --git a/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs b/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs new file mode 100644 index 0000000000..0905016c42 --- /dev/null +++ b/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs @@ -0,0 +1,28 @@ +using System;
+using System.Linq;
+using System.Threading.Tasks;
+using MediaBrowser.Common.Net.Handlers;
+using MediaBrowser.Controller;
+using MediaBrowser.Model.DTO;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Api.HttpHandlers
+{
+ class UserAuthenticationHandler : BaseSerializationHandler<AuthenticationResult>
+ {
+ protected override async Task<AuthenticationResult> GetObjectToSerialize()
+ {
+ Guid userId = Guid.Parse(QueryString["userid"]);
+ User user = Kernel.Instance.Users.First(u => u.Id == userId);
+
+ string password = await GetFormValue("password").ConfigureAwait(false);
+
+ AuthenticationResult result = new AuthenticationResult()
+ {
+ Success = true
+ };
+
+ return result;
+ }
+ }
+}
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 8f387e0659..7b17606a8b 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -73,6 +73,7 @@ <Compile Include="HttpHandlers\ServerConfigurationHandler.cs" />
<Compile Include="HttpHandlers\StudioHandler.cs" />
<Compile Include="HttpHandlers\StudiosHandler.cs" />
+ <Compile Include="HttpHandlers\UserAuthenticationHandler.cs" />
<Compile Include="HttpHandlers\UsersHandler.cs" />
<Compile Include="HttpHandlers\VideoHandler.cs" />
<Compile Include="HttpHandlers\WeatherHandler.cs" />
diff --git a/MediaBrowser.Api/Plugin.cs b/MediaBrowser.Api/Plugin.cs index e83f366dfd..f254adbb6b 100644 --- a/MediaBrowser.Api/Plugin.cs +++ b/MediaBrowser.Api/Plugin.cs @@ -117,6 +117,10 @@ namespace MediaBrowser.Api {
return new PluginAssemblyHandler();
}
+ else if (IsUrlMatch("/api/UserAuthentication", localPath))
+ {
+ return new UserAuthenticationHandler();
+ }
return null;
}
|
