diff options
Diffstat (limited to 'lib/chessh/auth/password.ex')
-rw-r--r-- | lib/chessh/auth/password.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chessh/auth/password.ex b/lib/chessh/auth/password.ex index ea2c8fc..0986169 100644 --- a/lib/chessh/auth/password.ex +++ b/lib/chessh/auth/password.ex @@ -1,9 +1,13 @@ defmodule Chessh.Auth.PasswordAuthenticator do alias Chessh.{Player, Repo} + def authenticate(player = %Player{}, password) do + Player.valid_password?(player, password) + end + def authenticate(username, password) do case Repo.get_by(Player, username: username) do - x -> Player.valid_password?(x, password) + player -> authenticate(player, password) end end end |