Addressed the unsecure login HTTP endpoint and user the Performers property instead of the deprecated Artists property from the TagLib library. #38

This commit is contained in:
amazing-username
2019-05-11 16:42:29 -04:00
parent c0ac3cdd30
commit 9bfb43e46a
13 changed files with 267 additions and 60 deletions
+21 -5
View File
@@ -35,21 +35,37 @@ namespace Icarus.Controllers
#endregion
[HttpPost]
public void Post([FromBody] User user)
public IActionResult Post([FromBody] User user)
{
Console.WriteLine($"Username: {user.Username}");
Console.WriteLine($"Password: {user.Password}");
PasswordEncryption pe = new PasswordEncryption();
user.Password = pe.HashPassword(user);
user.EmailVerified = false;
Console.WriteLine($"Hashed Password: {user.Password}");
UserStoreContext context = HttpContext
.RequestServices
.GetService(typeof(UserStoreContext)) as UserStoreContext;
context.SaveUser(user);
var registerResult = new RegisterResult
{
Username = user.Username
};
if (context.DoesUserExist(user))
{
registerResult.Message = "Successful registration";
registerResult.SuccessfullyRegistered = true;
return Ok(registerResult);
}
else
{
registerResult.Message = "Registration failed";
registerResult.SuccessfullyRegistered = false;
return Ok(registerResult);
}
}
}
}