From 720a110c957a9ac1399ca3d2324b5b2cf8bbf3c6 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Tue, 3 Jan 2023 16:47:27 -0700 Subject: [PATCH] Fix issue when username is nil --- lib/chessh/auth/password.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/chessh/auth/password.ex b/lib/chessh/auth/password.ex index 0986169..d9c32c4 100644 --- a/lib/chessh/auth/password.ex +++ b/lib/chessh/auth/password.ex @@ -5,6 +5,8 @@ defmodule Chessh.Auth.PasswordAuthenticator do Player.valid_password?(player, password) end + def authenticate(username, _password) when is_nil(username), do: false + def authenticate(username, password) do case Repo.get_by(Player, username: username) do player -> authenticate(player, password)