mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Set the admin to have all claims
This commit is contained in:
parent
a679f1a6a1
commit
16bd4f5b71
4 changed files with 87 additions and 20 deletions
|
@ -35,6 +35,7 @@ using Nancy.Security;
|
|||
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.UI.Models;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
|
@ -103,7 +104,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
return Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl) ? $"~/{BaseUrl}/register?error=true" : "~/register?error=true");
|
||||
}
|
||||
var userId = UserMapper.CreateUser(username, Request.Form.Password, new[] { "Admin" });
|
||||
var userId = UserMapper.CreateAdmin(username, Request.Form.Password);
|
||||
Session[SessionKeys.UsernameKey] = username;
|
||||
return this.LoginAndRedirect((Guid)userId);
|
||||
};
|
||||
|
|
|
@ -46,24 +46,24 @@ namespace PlexRequests.UI.Modules
|
|||
return Response.AsJson(users);
|
||||
}
|
||||
|
||||
private Response CreateUser(string username, string password, string claims)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel
|
||||
{
|
||||
Result = true,
|
||||
Message = "Please enter in a valid Username and Password"
|
||||
});
|
||||
}
|
||||
var user = UserMapper.CreateUser(username, password, new string[] {claims});
|
||||
if (user.HasValue)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel {Result = true});
|
||||
}
|
||||
//private Response CreateUser(string username, string password, string claims)
|
||||
//{
|
||||
// if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
|
||||
// {
|
||||
// return Response.AsJson(new JsonResponseModel
|
||||
// {
|
||||
// Result = true,
|
||||
// Message = "Please enter in a valid Username and Password"
|
||||
// });
|
||||
// }
|
||||
// var user = UserMapper.CreateUser(username, password, new string[] {claims});
|
||||
// if (user.HasValue)
|
||||
// {
|
||||
// return Response.AsJson(new JsonResponseModel {Result = true});
|
||||
// }
|
||||
|
||||
return Response.AsJson(new JsonResponseModel {Result = false, Message = "Could not save user"});
|
||||
}
|
||||
// return Response.AsJson(new JsonResponseModel {Result = false, Message = "Could not save user"});
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue