Skip to content

Instantly share code, notes, and snippets.

@TeijiW
Last active June 8, 2021 12:39
Show Gist options
  • Save TeijiW/0d983759ca90e350daca49d4b83ff054 to your computer and use it in GitHub Desktop.
Save TeijiW/0d983759ca90e350daca49d4b83ff054 to your computer and use it in GitHub Desktop.
Codes for Medium article
<%= if !@email do %>
<%= form_for :user, "#", [phx_submit: :login]\, fn f -> %>
<%= label f, :email, "E-mail" %>
<%= email_input f, :email, required: true %>
<%= if @email_input_error do %>
<span> <%= @email_input_error %> </span>
<% end %>
<%= submit "Continue" %>
<% end %>
<% end %>
<%= if @email && !@email_input_errors do %>
<%= form_for :user, Routes.user_session_path(@socket, :create), [as: :user], fn f -> %>
<%= hidden_input f, :email, value: @email %>
<%= label f, :code, "Code" %>
<%= text_input f, :code, required: true %>
<%= submit "Confirm code" %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment