summaryrefslogtreecommitdiff
path: root/lib/chessh/auth/password.ex
blob: e2c26d6abc4e97dfb1e1b400f8ec28d64fe5d7eb (plain)
1
2
3
4
5
6
7
8
9
10
11
defmodule Chessh.Auth.PasswordAuthenticator do
  alias Chessh.Player
  alias Chessh.Repo
  use Sshd.PasswordAuthenticator

  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