Fix issue when username is nil
This commit is contained in:
parent
16281b0e8d
commit
720a110c95
@ -5,6 +5,8 @@ defmodule Chessh.Auth.PasswordAuthenticator do
|
|||||||
Player.valid_password?(player, password)
|
Player.valid_password?(player, password)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def authenticate(username, _password) when is_nil(username), do: false
|
||||||
|
|
||||||
def authenticate(username, password) do
|
def authenticate(username, password) do
|
||||||
case Repo.get_by(Player, username: username) do
|
case Repo.get_by(Player, username: username) do
|
||||||
player -> authenticate(player, password)
|
player -> authenticate(player, password)
|
||||||
|
Loading…
Reference in New Issue
Block a user