Aggiedit/lib/aggiedit_web/templates/user_settings/edit.html.heex
2022-04-14 00:18:01 -06:00

66 lines
2.2 KiB
Plaintext

<h1>Settings</h1>
<h3>Change email</h3>
<.form let={f} for={@email_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_email">
<%= if @email_changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<%= hidden_input f, :action, name: "action", value: "update_email" %>
<div class="form-group">
<%= label f, :email %>
<%= email_input f, :email, required: true, class: "form-control" %>
<%= error_tag f, :email %>
</div>
<div class="form-group mt-2">
<%= label f, :current_password, for: "current_password_for_email" %>
<%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_email", class: "form-control" %>
<%= error_tag f, :current_password %>
</div>
<div class="mt-2">
<%= submit "Change email", class: "btn btn-primary" %>
</div>
</.form>
<hr>
<h3>Change password</h3>
<.form let={f} for={@password_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_password">
<%= if @password_changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<%= hidden_input f, :action, name: "action", value: "update_password" %>
<div class="form-group">
<%= label f, :password, "New password" %>
<%= password_input f, :password, required: true, class: "form-control" %>
<%= error_tag f, :password %>
</div>
<div class="form-group mt-2">
<%= label f, :password_confirmation, "Confirm new password" %>
<%= password_input f, :password_confirmation, required: true, class: "form-control" %>
<%= error_tag f, :password_confirmation %>
</div>
<div class="form-group mt-2">
<%= label f, :current_password, for: "current_password_for_password" %>
<%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_password", class: "form-control" %>
<%= error_tag f, :current_password %>
</div>
<div class="mt-2">
<%= submit "Change password", class: "btn btn-primary" %>
</div>
</.form>