Comments

profile/avatar/default
Egoleo

I am getting the below error with your code.


[error] #PID<0.551.0> running MessengyrWeb.Endpoint (connection #PID<0.543.0>, stream id 4) terminated

Server: localhost:4000 (http)

Request: POST /login

** (exit) an exception was raised:

** (ArgumentError) Comeonin.Bcrypt.checkpw has been removed.

Add {:bcrypt_elixir, "~> 2.0"} to the deps in your mix.exs file,

and use Bcrypt.verify_pass instead.


So i tried below code but still getting issues with it. 


Any ideas?


profile/avatar/default
Egoleo

WHat is message in this function?


def login_user(conn, %{"credentials" => credentials}) do

case Session.authenticate(credentials) do

{:ok, %{username: username}} ->

conn

|> put_flash(:info, "Logged in as #{username}!")

|> render("login.html")

{:error, message} ->

conn

|> put_flash(:error, message)

|> render("login.html")

end

end

Tristan Edwards

message is the error message that gets thrown.

profile/avatar/default
Egoleo

ok but is it supposed to as a variable? Because this is the error i am getting.


warning: variable "message" does not exist and is being expanded to "message()", please use parentheses to remove the ambiguity or change the variable name

lib/messengyr_web/controllers/page_controller.ex:53: MessengyrWeb.PageController.login_user/2

profile/avatar/default
Bret Savage

mix phoenix.gen.secret is deprecated. Use phx.gen.secret instead.

profile/avatar/default
Bret Savage

Or guardian.gen.secret

Tristan Edwards

@5avage: Thanks for the heads up. I've updated the lesson!

profile/avatar/default
Jeffylube

I also needed to include {bcrypt_elixir, "~&gt; 1.0"}