58 lines
2.5 KiB
Text
58 lines
2.5 KiB
Text
<div id="<%= @id %>" class="col-sm-9 col-md-7 col-lg-5 col-xl-4 mt-1">
|
|
|
|
<h3>Change password</h3>
|
|
|
|
<%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, phx_target: @myself], fn f -> %>
|
|
|
|
<%= label f, :password, "New password", class: "form-label" %>
|
|
<div class="inner-addon left-addon mb-3" phx-feedback-for="<%= input_id(f, :password) %>">
|
|
<%= icon_div @socket, "bi-key", [class: "icon is-left text-muted fs-5"] %>
|
|
<%= password_input f, :password,
|
|
value: input_value(f, :password),
|
|
class: input_class(f, :password, "form-control"),
|
|
maxlength: User.max_password,
|
|
phx_debounce: "500",
|
|
aria_describedby: error_ids(f, :password)
|
|
%>
|
|
<%= error_tag f, :password %>
|
|
</div>
|
|
|
|
<%= label f, :password_confirmation, "Confirm new password", class: "form-label" %>
|
|
<div class="inner-addon left-addon mb-3" phx-feedback-for="<%= input_id(f, :password_confirmation) %>">
|
|
<%= icon_div @socket, "bi-key-fill", [class: "icon is-left text-muted fs-5"] %>
|
|
<%= password_input f, :password_confirmation,
|
|
value: input_value(f, :password_confirmation),
|
|
class: input_class(f, :password_confirmation, "form-control"),
|
|
maxlength: User.max_password,
|
|
aria_describedby: error_ids(f, :password_confirmation)
|
|
%>
|
|
<%= error_tag f, :password_confirmation %>
|
|
</div>
|
|
|
|
<%= label f, :current_password, class: "form-label" %>
|
|
<div class="inner-addon left-addon mb-3">
|
|
<%= icon_div @socket, "bi-lock", [class: "icon is-left text-muted fs-5"] %>
|
|
<%= password_input f, :current_password,
|
|
value: input_value(f, :current_password),
|
|
id: "user_password_current_password",
|
|
class: "form-control"
|
|
%>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<%= submit "Change password",
|
|
class: "btn btn-primary",
|
|
disabled: !@changeset.valid? || input_value(f, :current_password) == "",
|
|
aria_disabled: (!@changeset.valid? || input_value(f, :current_password) == "") && "true" || false,
|
|
phx_disable_with: "Saving..."
|
|
%>
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%# hidden form for initial login after registration %>
|
|
<%= form_for :user, Routes.user_session_path(@socket, :create), [phx_trigger_action: @trigger_submit, id: "settings_pw_change_trigger"], fn f -> %>
|
|
<%= hidden_input f, :params_token, value: Phoenix.Token.encrypt(Shift73kWeb.Endpoint, "login_params", @login_params) %>
|
|
<% end %>
|
|
|
|
</div>
|