Fix issue when username is nil

This commit is contained in:
Logan Hunt 2023-01-03 16:47:27 -07:00
parent 16281b0e8d
commit 720a110c95
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49

View File

@ -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)