fixes #408 - Apostrophes in profile names are bad.

This commit is contained in:
Luke Pulverenti 2013-07-26 15:19:25 -04:00
parent 17c7f27e3f
commit 6bbf3e5efb
3 changed files with 8 additions and 7 deletions

View File

@ -88,7 +88,7 @@ namespace MediaBrowser.Api
/// <summary>
/// Class AuthenticateUser
/// </summary>
[Route("/Users/{Name}/AuthenticateByName", "POST")]
[Route("/Users/AuthenticateByName", "POST")]
[Api(Description = "Authenticates a user")]
public class AuthenticateUserByName : IReturn<AuthenticationResult>
{
@ -96,8 +96,8 @@ namespace MediaBrowser.Api
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string Name { get; set; }
[ApiMember(Name = "Username", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
public string Username { get; set; }
/// <summary>
/// Gets or sets the password.
@ -279,7 +279,7 @@ namespace MediaBrowser.Api
public object Post(AuthenticateUserByName request)
{
var user = _userManager.Users.FirstOrDefault(i => string.Equals(request.Name, i.Name, StringComparison.OrdinalIgnoreCase));
var user = _userManager.Users.FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase));
var result = AuthenticateUser(new AuthenticateUser { Id = user.Id, Password = request.Password }).Result;

View File

@ -1898,10 +1898,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
throw new Error("null name");
}
var url = self.getUrl("Users/" + name + "/authenticatebyname");
var url = self.getUrl("Users/authenticatebyname");
var postData = {
password: MediaBrowser.SHA1(password || "")
password: MediaBrowser.SHA1(password || ""),
Username: name
};
return self.ajax({

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.145" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.146" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.56" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.55" targetFramework="net45" />
</packages>