users: use sudo mode when changing email addresses.
When a user tries to change their email, redirect them to the confirm password page (like Github's sudo mode) instead of having them re-enter their password on the change email page. This is the same thing we do when a user updates their API keys. This way we have can use the same confirm password authentication flow for everything that needs a password.
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
<div id="c-emails">
|
||||
<div id="a-edit" class="fixed-width-container">
|
||||
<% page_title "Change Email" %>
|
||||
<h1>Change Email</h1>
|
||||
|
||||
<% if @user.email_address.present? %>
|
||||
<% page_title "Change Email" %>
|
||||
<h1>Change Email</h1>
|
||||
|
||||
<p>Your current email address is <strong><%= @user.email_address.address %></strong>.
|
||||
You must re-enter your password in order to update your email address.</p>
|
||||
<% else %>
|
||||
<% page_title "Add Email" %>
|
||||
<h1>Add Email</h1>
|
||||
|
||||
<p>Add a new email address below. You must re-enter your password in
|
||||
order to update your email address.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @user.is_restricted? %>
|
||||
@@ -23,8 +16,7 @@
|
||||
<% end %>
|
||||
|
||||
<%= edit_form_for(@user, url: user_email_path(@user)) do |f| %>
|
||||
<%= f.input :email, as: :email, label: "New Email", input_html: { value: "" } %>
|
||||
<%= f.input :password %>
|
||||
<%= f.input :email, as: :email, input_html: { value: @user&.email_address&.address } %>
|
||||
<%= f.submit "Save" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user