mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
[server] Fix crashes in new user auth system
This commit is contained in:
parent
9137426942
commit
40d9c121e4
1 changed files with 3 additions and 3 deletions
|
@ -55,10 +55,10 @@ namespace Nibriboard
|
|||
public override bool ShouldAcceptConnection(HttpRequest connectionRequest, HttpResponse connectionResponse)
|
||||
{
|
||||
HttpBasicAuthCredentials credentials = connectionRequest.BasicAuthCredentials;
|
||||
User user = NibriServer.AccountManager.GetByName(credentials.Username);
|
||||
if (user == null || user.CheckPassword(credentials.Password)) {
|
||||
User user = NibriServer.AccountManager.GetByName(credentials != null ? credentials.Username : null);
|
||||
if (user == null || user.CheckPassword(credentials != null ? credentials.Password : null)) {
|
||||
// Authentication failed!
|
||||
connectionResponse.ResponseCode = HttpResponseCode.Forbidden;
|
||||
connectionResponse.RequireHttpBasicAuthentication("Nibriboard");
|
||||
connectionResponse.ContentType = "text/plain";
|
||||
connectionResponse.SetBody("Error: Invalid username or password.");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue