summaryrefslogtreecommitdiff
path: root/lib/chessh
diff options
context:
space:
mode:
authorLogan Hunt <logan.hunt@usu.edu>2023-01-03 16:47:27 -0700
committerLogan Hunt <logan.hunt@usu.edu>2023-01-03 16:47:27 -0700
commit720a110c957a9ac1399ca3d2324b5b2cf8bbf3c6 (patch)
tree986892e849aa653a02df45f2d6245429d2ca9907 /lib/chessh
parent16281b0e8deb6b3bf86ac0b9381f3fdf89b22b58 (diff)
downloadchessh-720a110c957a9ac1399ca3d2324b5b2cf8bbf3c6.tar.gz
chessh-720a110c957a9ac1399ca3d2324b5b2cf8bbf3c6.zip
Fix issue when username is nil
Diffstat (limited to 'lib/chessh')
-rw-r--r--lib/chessh/auth/password.ex2
1 files changed, 2 insertions, 0 deletions
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)