<commit_before>defmodule ElixirJobsWeb.Router do
  use ElixirJobsWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", ElixirJobsWeb do
    pipe_through :browser # Use the default browser stack

    get "/", OfferController, :index
    get "/rss", OfferController, :rss
    get "/page/:page_number", OfferController, :index, as: :offer_page
    get "/offers/new", OfferController, :new
    post "/offers/new", OfferController, :create
    get "/offers/:slug", OfferController, :show

    get "/login", AuthController, :new
    post "/login", AuthController, :create
    get "/logout", AuthController, :delete
  end

  # Other scopes may use custom stacks.
  # scope "/api", ElixirJobsWeb do
  #   pipe_through :api
  # end
end
<commit_msg>Add authenticated router<commit_after>defmodule ElixirJobsWeb.Router do
  use ElixirJobsWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
    plug Guardian.Plug.VerifyHeader
  end

  pipeline :authentication_required do
    plug Guardian.Plug.EnsureAuthenticated,
      error_handler: ElixirJobsWeb.AuthController
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", ElixirJobsWeb do
    pipe_through :browser # Use the default browser stack

    get "/", OfferController, :index
    get "/rss", OfferController, :rss
    get "/page/:page_number", OfferController, :index, as: :offer_page
    get "/offers/new", OfferController, :new
    post "/offers/new", OfferController, :create
    get "/offers/:slug", OfferController, :show

    get "/login", AuthController, :new
    post "/login", AuthController, :create
  end

  scope "/", ElixirJobsWeb do
    pipe_through [:browser, :authentication_required] # Use the default browser stack

    get "/logout", AuthController, :delete
  end

  # Other scopes may use custom stacks.
  # scope "/api", ElixirJobsWeb do
  #   pipe_through :api
  # end
end

{'fraction_non_alphanumeric': 0.10242341106538637, 'fraction_numerical': 0.0, 'mean_word_length': 3.577405857740586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6117725', 'n_tokens_mistral': 711, 'n_tokens_neox': 685, 'n_words': 204}