fixes #408 - Apostrophes in profile names are bad.

pull/702/head
Luke Pulverenti 11 years ago
parent 17c7f27e3f
commit 6bbf3e5efb

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

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <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.Common" version="3.9.56" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.55" targetFramework="net45" /> <package id="ServiceStack.Text" version="3.9.55" targetFramework="net45" />
</packages> </packages>
Loading…
Cancel
Save