 defmodule TilexWeb.AuthController do
   use TilexWeb, :controller
-  plug Ueberauth
+  plug(Ueberauth)
 
   alias Guardian.Plug
   alias Tilex.{Developer, Repo}

  end

  def index(conn, _params) do
    redirect conn, to: "/auth/google"
  end

  def delete(conn, _params) do
    conn
    |> Plug.sign_out
    |> put_flash(:info, "Signed out")
    |> redirect(to: "/")
  end

  defp authenticate(%{info: info, uid: uid}) do
    email = Map.get(info, :email)
    name  = Developer.format_username(Map.get(info, :name))

    case String.match?(email, ~r/@hashrocket.com$/) do
      true ->

        }

        Developer.find_or_create(Repo, attrs)

      _ ->
        {:error, email}
    end
