<commit_before>defmodule Officetournament.LoginController do
  use Officetournament.Web, :controller

  alias Officetournament.Login

  plug :scrub_params, "login" when action in [:create, :update]
  plug :action

  def index(conn, _params) do
    render(conn, "index.html")
  end

  def login(conn, %{"login" => %{"username" => username, "password" => password}}) do
    conn
    |> put_flash(:info, "Welcome #{username}! I like your password #{password}")
    |> redirect(to: login_path(conn, :index))
  end

  def login(conn, params) do
    conn
    |> put_flash(:info, "Access Denied")
    |> render "unauthorized.html"
  end
end<commit_msg>Use proper layout and status code<commit_after>defmodule Officetournament.LoginController do
  use Officetournament.Web, :controller

  alias Officetournament.Login

  plug :scrub_params, "login" when action in [:create, :update]
  plug :action

  def index(conn, _params) do
    render(conn, "index.html")
  end

  def login(conn, %{"login" => %{"username" => username, "password" => password}}) do
    conn
    |> put_flash(:info, "Welcome #{username}! I like your password #{password}")
    |> redirect(to: login_path(conn, :index))
  end

  def login(conn, params) do
    conn
    |> put_layout(false)
    |> put_status(401)
    |> render "unauthorized.html"
  end
end
{'fraction_non_alphanumeric': 0.13515565679574792, 'fraction_numerical': 0.002277904328018223, 'mean_word_length': 4.188976377952756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2120054', 'n_tokens_mistral': 445, 'n_tokens_neox': 417, 'n_words': 119}