2022-02-15 23:52:44 -05:00
|
|
|
<div class="mb-8 flex flex-col justify-center items-center space-y-4">
|
|
|
|
<h1 class="pb-4 title text-primary-500 text-xl">
|
2022-02-08 23:50:05 -05:00
|
|
|
<%= gettext("Settings") %>
|
|
|
|
</h1>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="hr" />
|
2022-02-08 23:50:05 -05:00
|
|
|
|
|
|
|
<%= form_for @email_changeset,
|
|
|
|
Routes.user_settings_path(@conn, :update),
|
2022-02-16 18:45:18 -05:00
|
|
|
[
|
|
|
|
class:
|
|
|
|
"pb-4 flex flex-col sm:grid sm:grid-cols-3" <>
|
|
|
|
"justify-center items-center text-center space-y-4"
|
|
|
|
],
|
2022-02-08 23:50:05 -05:00
|
|
|
fn f -> %>
|
2022-02-15 23:52:44 -05:00
|
|
|
<h3 class="title text-primary-500 text-lg col-span-3">
|
|
|
|
<%= dgettext("actions", "Change email") %>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<%= if @email_changeset.action && not @email_changeset.valid? do %>
|
|
|
|
<div class="alert alert-danger col-span-3">
|
2022-02-08 23:50:05 -05:00
|
|
|
<p>
|
|
|
|
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
|
|
|
|
|
2022-02-15 23:52:44 -05:00
|
|
|
<%= label(f, :email, class: "title text-lg text-primary-500") %>
|
|
|
|
<%= email_input(f, :email, required: true, class: "mx-2 my-1 input input-primary col-span-2") %>
|
|
|
|
<%= error_tag(f, :email, "col-span-3") %>
|
|
|
|
|
|
|
|
<%= label(f, :current_password, gettext("Current password"),
|
|
|
|
for: "current_password_for_email",
|
|
|
|
class: "mx-2 my-1 title text-lg text-primary-500"
|
|
|
|
) %>
|
|
|
|
<%= password_input(f, :current_password,
|
|
|
|
required: true,
|
|
|
|
name: "current_password",
|
|
|
|
id: "current_password_for_email",
|
|
|
|
class: "mx-2 my-1 input input-primary col-span-2"
|
|
|
|
) %>
|
|
|
|
<%= error_tag(f, :current_password, "col-span-3") %>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<%= submit(dgettext("actions", "Change email"),
|
|
|
|
class: "mx-auto my-4 btn btn-primary col-span-3"
|
|
|
|
) %>
|
2022-02-08 23:50:05 -05:00
|
|
|
<% end %>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="hr" />
|
2022-02-08 23:50:05 -05:00
|
|
|
|
|
|
|
<%= form_for @password_changeset,
|
|
|
|
Routes.user_settings_path(@conn, :update),
|
2022-02-15 23:52:44 -05:00
|
|
|
[
|
|
|
|
class:
|
|
|
|
"pb-4 flex flex-col sm:grid sm:grid-cols-3 justify-center items-center text-center space-y-4"
|
|
|
|
],
|
2022-02-08 23:50:05 -05:00
|
|
|
fn f -> %>
|
2022-02-15 23:52:44 -05:00
|
|
|
<h3 class="title text-primary-500 text-lg col-span-3">
|
|
|
|
<%= dgettext("actions", "Change password") %>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<%= if @password_changeset.action && not @password_changeset.valid? do %>
|
|
|
|
<div class="alert alert-danger col-span-3">
|
2022-02-08 23:50:05 -05:00
|
|
|
<p>
|
|
|
|
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
|
|
|
|
|
2022-02-15 23:52:44 -05:00
|
|
|
<%= label(f, :password, gettext("New password"), class: "title text-lg text-primary-500") %>
|
|
|
|
<%= password_input(f, :password,
|
|
|
|
required: true,
|
|
|
|
class: "mx-2 my-1 input input-primary col-span-2"
|
|
|
|
) %>
|
|
|
|
<%= error_tag(f, :password, "col-span-3") %>
|
|
|
|
|
|
|
|
<%= label(f, :password_confirmation, gettext("Confirm new password"),
|
|
|
|
class: "title text-lg text-primary-500"
|
|
|
|
) %>
|
|
|
|
<%= password_input(f, :password_confirmation,
|
|
|
|
required: true,
|
|
|
|
class: "mx-2 my-1 input input-primary col-span-2"
|
|
|
|
) %>
|
|
|
|
<%= error_tag(f, :password_confirmation, "col-span-3") %>
|
|
|
|
|
|
|
|
<%= label(f, :current_password, gettext("Current password"),
|
|
|
|
for: "current_password_for_password",
|
|
|
|
class: "title text-lg text-primary-500"
|
|
|
|
) %>
|
|
|
|
<%= password_input(f, :current_password,
|
|
|
|
required: true,
|
|
|
|
name: "current_password",
|
|
|
|
id: "current_password_for_password",
|
|
|
|
class: "mx-2 my-1 input input-primary col-span-2"
|
|
|
|
) %>
|
|
|
|
<%= error_tag(f, :current_password, "col-span-3") %>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<%= submit(dgettext("actions", "Change password"),
|
|
|
|
class: "mx-auto my-4 btn btn-primary col-span-3"
|
|
|
|
) %>
|
2022-02-08 23:50:05 -05:00
|
|
|
<% end %>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="hr" />
|
2022-02-15 23:52:44 -05:00
|
|
|
|
2022-02-08 23:50:05 -05:00
|
|
|
<%= link(dgettext("actions", "Delete User"),
|
|
|
|
to: Routes.user_settings_path(@conn, :delete, @current_user),
|
|
|
|
method: :delete,
|
|
|
|
class: "btn btn-alert",
|
|
|
|
data: [confirm: dgettext("prompts", "Are you sure you want to delete your account?")]
|
|
|
|
) %>
|
|
|
|
</div>
|