i making “forget-remind password” at website
1st part –
(get user’s email, send message with url-code to that email)
– all ok
2nd part –
(user go to url-code and set up new password for him account)
— is not ok
(phoenix 1.2.1, Elixir 1.3.1)
in router
get “/remind-password/:email/:remind_code”, PageController, :setup_remind_password
post “/remind-password/:email/:remind_code”, PageController, :do_setup_remind_password
in Controller
def setup_remind_password(conn, %{“email” => email, “remind_code” => remind_code}) do
changeset = Planetwork.EmailRemindPasswordCode.changeset
render conn, “setup_remind_password.html”, changeset: changeset, email: email, remind_code: remind_code
enddef do_setup_remind_password(conn, params) do
case Planetwork.EmailRemindPasswordCode.changeset(%Planetwork.EmailRemindPasswordCode{}, params)
do
{:ok, changeset} →
conn
|> put_session(:user_id, changeset.changes.account_id)
|> redirect(to: “/cabinet”)
{:error, changeset} →
render conn, “setup_remind_password.html”, changeset: changeset, email: params[“email”], remind_code: params[“remind_code”]
end
end
in template
<%= form_for @changeset, page_path(@conn, :do_setup_remind_password), [id: "remind-password-form", class: ""], fn f -> %>
<div class="row"> <div class="input-field col s12"> <label for="remind_password_form_password"><%= gettext "Password" %></label> <%= password_input f, :password, required: true, class: validate(f, :password), id: "remind_password_form_password" %> <%= error_tag f, :password %> </div> </div>
<div class="center"> <button class="center btn waves-effect" type="submit"><%= gettext "Save password" %></button> </div>
<% end %>
Why phoenix says that i have error in template at string
<%= form_for @changeset, page_path(@conn, :do_setup_remind_password), [id: “remind-password-form”, class: “”], fn f → %>
???
error
ArgumentError
at GET
/remind-password/usersmail@gmail.com/6crhewhwgqp4sswuyob75k8lz9hicr/
No helper clause for Planetwork.Router.Helpers.page_path defined for action :do_setup_remind_password with arity 2.
Please check that the function, arity and action are correct.
The following page_path actions are defined under your router:
- :about
- :do_login
- :do_setup_password
- :do_setup_remind_password
- :do_signup
- :do_signup
- :login
- :login
- :remind_password
- :send_remind_password
- :setup_password
- :setup_remind_password
- :signup
- :signup_with_code
how solve that ?
please help!!