diff --git a/lib/chess.ex b/lib/chess.ex index 75097e7..923ec2f 100644 --- a/lib/chess.ex +++ b/lib/chess.ex @@ -1,4 +1,6 @@ defmodule Chess do + @moduledoc false + use Application # See http://elixir-lang.org/docs/stable/elixir/Application.html diff --git a/lib/chess/auth.ex b/lib/chess/auth.ex index 44a0c39..4b22712 100644 --- a/lib/chess/auth.ex +++ b/lib/chess/auth.ex @@ -105,10 +105,11 @@ defmodule Chess.Auth do @doc false def authenticate_user(username, password) do - Repo.one( - from u in User, - where: u.username == ^username - ) + query = from u in User, + where: u.username == ^username + + query + |> Repo.one |> Argon2.check_pass(password) end end diff --git a/lib/chess/auth/guardian.ex b/lib/chess/auth/guardian.ex index 7af60b8..5b4fef9 100644 --- a/lib/chess/auth/guardian.ex +++ b/lib/chess/auth/guardian.ex @@ -1,4 +1,6 @@ defmodule Chess.Auth.Guardian do + @moduledoc false + use Guardian, otp_app: :chess alias Chess.Auth diff --git a/lib/chess/board.ex b/lib/chess/board.ex index 341a453..b4c9faa 100644 --- a/lib/chess/board.ex +++ b/lib/chess/board.ex @@ -1,4 +1,6 @@ defmodule Chess.Board do + @moduledoc false + def output(board) do Enum.map(0..7, fn (rank) -> Enum.map(0..7, fn (file) -> diff --git a/lib/chess/store/game.ex b/lib/chess/store/game.ex index d3e66ac..6db4ba5 100644 --- a/lib/chess/store/game.ex +++ b/lib/chess/store/game.ex @@ -1,4 +1,6 @@ defmodule Chess.Store.Game do + @moduledoc false + use Ecto.Schema use Timex.Ecto.Timestamps diff --git a/lib/chess_web/controllers/game_controller.ex b/lib/chess_web/controllers/game_controller.ex index 4420783..d5bfb0a 100644 --- a/lib/chess_web/controllers/game_controller.ex +++ b/lib/chess_web/controllers/game_controller.ex @@ -5,10 +5,12 @@ defmodule ChessWeb.GameController do def index(conn, _params) do changeset = Game.changeset(%Game{}) - games = Game - |> Game.for_user(current_user(conn)) - |> Game.ordered - |> Repo.all + games = + Game + |> Game.for_user(current_user(conn)) + |> Game.ordered + |> Repo.all + render(conn, "index.html", games: games, changeset: changeset) end