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

  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