From 42425b02260d279cd9c12fb3e625282979b9e308 Mon Sep 17 00:00:00 2001 From: Simponic Date: Fri, 30 Dec 2022 05:46:35 -0700 Subject: Add scalable session thresholds --- lib/chessh/auth/password.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/chessh/auth/password.ex') diff --git a/lib/chessh/auth/password.ex b/lib/chessh/auth/password.ex index ea2c8fc..a01291d 100644 --- a/lib/chessh/auth/password.ex +++ b/lib/chessh/auth/password.ex @@ -1,9 +1,14 @@ 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) + nil -> false end end end -- cgit v1.2.3-70-g09d2