 
   alias Officetournament.Login
   alias Officetournament.User
-  # plug Officetournament.Plugs.Authenticate
 
   plug :scrub_params, "login" when action in [:create, :update]
 

  end

  defp check_password(user, password) do
    Logger.debug "Checking password: #{password}"

    Comeonin.Bcrypt.checkpw(password, user.password)
  end
end

  end

  defp find_user_and_pass(username, password) do
    user = Repo.one(from u in User,
                    where: u.username == ^username,
                    select: u)

    if check_password(user, password) do
      user
