From 8fc828361e6e6019bc833ffba1d5ef8fc8605ac9 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Fri, 7 Sep 2012 12:17:39 -0400 Subject: Updated authentication --- .../HttpHandlers/UserAuthenticationHandler.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs') diff --git a/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs b/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs index 8f6680530..9f72aa417 100644 --- a/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/UserAuthenticationHandler.cs @@ -1,10 +1,7 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using MediaBrowser.Common.Net.Handlers; +using MediaBrowser.Common.Net.Handlers; using MediaBrowser.Controller; -using MediaBrowser.Model.DTO; using MediaBrowser.Model.Entities; +using System.Threading.Tasks; namespace MediaBrowser.Api.HttpHandlers { @@ -12,15 +9,12 @@ namespace MediaBrowser.Api.HttpHandlers { protected override async Task GetObjectToSerialize() { - Guid userId = Guid.Parse(await GetFormValue("userid").ConfigureAwait(false)); - User user = Kernel.Instance.Users.First(u => u.Id == userId); + string userId = await GetFormValue("userid").ConfigureAwait(false); + User user = ApiService.GetUserById(userId, false); string password = await GetFormValue("password").ConfigureAwait(false); - return new AuthenticationResult() - { - Success = Kernel.GetMD5(password).Equals(user.Password) - }; + return Kernel.Instance.AuthenticateUser(user, password); } } } -- cgit v1.2.3