Issues with logging in/out with Rumbl app from Programming Phoenix

Need some assistance. I am walking through the Rumbl app in Programming Phoenix, though I have renamed it to Shaolin.

Running into an issue with logging in.

Here is the output of my Cowboy server:

[debug] Processing by Shaolin.SessionController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 365µs

Here is my SessionController’s new function:

  def new(conn, _) do
    render conn, "new.html"
  end

Here are the contents of web/templates/session/new.html.eex


<%= form_for @conn, session_path(@conn, :create), [as: :session], fn f -> %>
  <div class="form-group">
    <%= text_input f, :username, placeholder: "Username", class: "form-control" %>
    <%= error_tag f, :username %>
  </div>
  <div class="form-group">
    <%= password_input f, :password, placeholder: "Password", class: "form-control" %>
    <%= error_tag f, :password %>
  </div>
  <%= submit "Log in", class: "btn btn-primary" %>
<% end %>

When I click “Log in”, the screen only shows the Phoenix Framework logo, the “Register” button and the “Log in” button, nothing else. The URL is presented as “https://shaolingeek.io/sessions/new”.

I am not seeing the form from web/templates/session/new.html.eex.

I do not have any errors in the browser or in the Cowboy server output.

Even if I remove the web/templates/session/new.html.eex, I do not see any errors.

Any assistance is greatly appreciated.

Don’t you have a create action? Th new action doesn’t do anything else than render the form.
The create action is the one to which you send the data from the form and then it process it.

If you pay attention, in <%= form_for @conn, session_path(@conn, :create), [as: :session], fn f -> %> you have :create that’s the Create action of the Session controller.

2 Likes

Thanks for looking at this Teddy, Happy Holidays.

What’s confusing me is that it doesn’t seem to actually render the new.html form

Rich

Oh, I understand.

Have you added resources for sessions in router.ex?

2 Likes

Yes, I have:

resources “/users”, UserController