<commit_before>defmodule Listen.Web.Helpers.Views.Identity do
  def identity_path(_conn, :login) do
    Listen.Config.get(:listen, :identity_base_path)
    |> Path.join("login")
  end

  def identity_path(_conn, :register) do
    Listen.Config.get(:listen, :identity_base_path)
    |> Path.join("register")
  end
end<commit_msg>Links to login and signup with a return_url<commit_after>defmodule Listen.Web.Helpers.Views.Identity do
  def identity_path(conn, :login) do
    Listen.Config.get(:listen, :identity_base_path)
    |> Path.join("login")
    |> URI.parse
    |> URI.merge(query(conn))
    |> URI.to_string
  end

  def identity_path(conn, :register) do
    Listen.Config.get(:listen, :identity_base_path)
    |> Path.join("register")
    |> URI.parse
    |> URI.merge(query(conn))
    |> URI.to_string
  end

  defp query(conn) do
    return_url = Listen.Web.Router.Helpers.url(conn) <> conn.request_path

    %URI{
      query: URI.encode_query(%{return_url: return_url})
    }
  end
end
{'fraction_non_alphanumeric': 0.1354062186559679, 'fraction_numerical': 0.0, 'mean_word_length': 3.8446601941747574, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 14, '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': '934767', 'n_tokens_mistral': 351, 'n_tokens_neox': 338, 'n_words': 63}