Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import Coherence.Rememberable.hash/1 because it is undefined or private #304

Open
sescobb27 opened this issue Nov 14, 2017 · 1 comment

Comments

@sescobb27
Copy link

Hi, i'm upgrading from coherence 0.4 to 0.5 and running mix coh.install --reinstall but now i'm getting the following error:

== Compilation error in file lib/twd_web/controllers/coherence/session_controller.ex ==
** (CompileError) lib/twd_web/controllers/coherence/session_controller.ex:12: cannot import Coherence.Rememberable.hash/1 because it is undefined or private
    (elixir) src/elixir_import.erl:77: :elixir_import.calculate/6
    (elixir) src/elixir_import.erl:18: :elixir_import.import/4
defmodule TwdWeb.Coherence.SessionController do
  @moduledoc """
  Handle the authentication actions.

  """
  use Coherence.Web, :controller
  use Timex
  use Coherence.Config

  import Coherence.TrackableService
  import Ecto.Query
  import Coherence.Rememberable, only: [hash: 1, gen_cookie: 3] # error

  alias Coherence.{Rememberable}
  alias Coherence.ControllerHelpers, as: Helpers
  alias Coherence.{ConfirmableService}
  alias Coherence.Messages

  require Logger

  @type schema :: Ecto.Schema.t
  @type conn :: Plug.Conn.t
  @type params :: Map.t

  plug :layout_view, view: Coherence.SessionView
  plug :redirect_logged_in when action in [:new, :create]
  ...
end
@ryanhart2
Copy link

ryanhart2 commented May 5, 2018

If you look at the latest session controller you will see that the lines import Coherence.Rememberable, only: [hash: 1, gen_cookie: 3] and alias Coherence.{Rememberable} are commented out. In place of these imported functions, the module now defines these local functions:

defp hash(value) do
  schema(Rememberable).hash value
end

defp gen_cookie(user_id, series, token) do
  schema(Rememberable).gen_cookie user_id, series, token
end

You will need to generate new controllers and use git diff to choose which changes to incorporate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants