summaryrefslogtreecommitdiff
path: root/lib/chessh/auth/password.ex
blob: 8a6c683a51ff6a6b17ad498a540fe3f0a6c67620 (plain)
1
2
3
4
5
6
7
8
9
10
defmodule Chessh.Auth.PasswordAuthenticator do
  alias Chessh.Player
  alias Chessh.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