1
0
Fork 0
forked from OpenNeo/impress
impress/app/views/devise/registrations/edit.html.erb
Emi Matchu 89fc99c918 Oops, fix bug for authorizing the NeoPass disconnect endpoint
Ahh right, in development `User` and `AuthUser` will have the same ID,
but that got messed up early on for us in production DTI 😅

Here, we switch the form to reference the `User` instead of the
`AuthUser` (to get the ID right), then we also change how we compare
the IDs, because `User#to_param` appends extra text onto the ID after
the number!
2024-04-07 08:11:22 -07:00

85 lines
2.8 KiB
Text

<h2>Settings</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: "settings-form" }) do |f| %>
<h2>Your info</h2>
<%= render "devise/shared/error_messages", resource: resource %>
<fieldset>
<div class="field">
<%= f.label :name, 'DTI Username' %>
<span class="hint">Use this to log in to Dress to Impress!</span>
<br />
<%= f.text_field :name, autocomplete: "username" %>
</div>
<div class="field">
<%= f.label :email %>
<span class="hint">This can help you recover your account later.</span>
<br />
<%= f.email_field :email, autocomplete: "email" %>
</div>
</fieldset>
<fieldset>
<div class="field">
<%= f.label :password, "New password" %>
<span class="hint">Leave blank if you don't want to change it.</span>
<br />
<%= f.password_field :password, autocomplete: "new-password" %>
<% if @minimum_password_length %>
<br />
<span class="hint"><%= @minimum_password_length %> characters minimum</span>
<% end %>
</div>
<div class="field">
<%= f.label :password_confirmation, "New password confirmation" %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
</fieldset>
<fieldset>
<div class="field">
<%= f.label :current_password %>
<span class="hint">We need your current password to confirm your changes.</span>
<br />
<%= f.password_field :current_password, autocomplete: "current-password" %>
</div>
</fieldset>
<div class="actions">
<%= f.submit "Save changes" %>
</div>
<% end %>
<% if resource.neopass? %>
<%= form_with url: user_neopass_connection_path(resource.user), method: :delete,
class: "settings-form", data: {
turbo_confirm: "Are you sure? Without a NeoPass, you'll need to use " +
"your password or your recovery email \"#{resource.email}\" to " +
"log in again.\n\nMake sure you have everything all set up first! " +
"Otherwise, you might be locked out of this account forever!"
} do |form|
%>
<h2>Your NeoPass</h2>
<section class="neopass-info">
<strong>
NeoPass ID:
</strong>
<%= resource.neopass_friendly_id %>
</section>
<section class="neopass-explanation">
<p>
You can log into your Dress to Impress account with NeoPass, or with
your username and password. If you ever lose access to your NeoPass,
you can still use "Forgot your password?" to recover your Dress to
Impress account, using the Email saved in "Your info".
</p>
</section>
<%= form.submit "Disconnect your NeoPass" %>
<% end %>
<% end %>
<% content_for :stylesheets do %>
<%= stylesheet_link_tag "devise/registrations/edit" %>
<% end %>