summaryrefslogtreecommitdiff
path: root/lib/chessh/auth/password.ex
blob: c3b03f5b04e928f4b063533932705c81a8251b3b (plain)
1
2
3
4
5
6
7
8
9
defmodule Chessh.Auth.PasswordAuthenticator do
  alias Chessh.{Player, Repo}

  def authenticate(username, password) do
    case Repo.get_by(Player, username: String.Chars.to_string(username)) do
      x -> Player.valid_password?(x, String.Chars.to_string(password))
    end
  end
end