1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Return better error message if username or password is null for forms login

This commit is contained in:
Mark McDowall 2019-04-06 19:31:08 -07:00
parent f748891b4b
commit 8f3dbbc356
2 changed files with 5 additions and 4 deletions

View File

@ -73,6 +73,11 @@ public User FindUser()
public User FindUser(string username, string password)
{
if (username.IsNullOrWhiteSpace() || password.IsNullOrWhiteSpace())
{
return null;
}
var user = _repo.FindUser(username.ToLowerInvariant());
if (user == null)

View File

@ -3,7 +3,6 @@
using Nancy.Authentication.Forms;
using Nancy.Extensions;
using Nancy.ModelBinding;
using NzbDrone.Common.EnsureThat;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration;
@ -24,9 +23,6 @@ public AuthenticationModule(IUserService userService, IConfigFileProvider config
private Response Login(LoginResource resource)
{
Ensure.That(resource.Username, () => resource.Username).IsNotNullOrWhiteSpace();
Ensure.That(resource.Password, () => resource.Password).IsNotNullOrWhiteSpace();
var user = _userService.FindUser(resource.Username, resource.Password);
if (user == null)