Commit c23ca24
Changed files (3)
app
controllers
views
my
mfas
spec
requests
my
app/controllers/my/mfas_controller.rb
@@ -20,7 +20,7 @@ module My
def destroy
current_user.tfa.disable!
- redirect_to my_dashboard_path
+ redirect_to my_dashboard_path, notice: 'MFA has been disabled'
end
end
end
app/views/my/mfas/edit.html.erb
@@ -1,13 +1,13 @@
<div class="container">
<div class="row">
<div class="col">
- <h1>Two Factor Authentication (TFA)</h1>
+ <h1>Multi-Factor Authentication (MFA)</h1>
<div data-controller="tfa--setup">
<canvas id="canvas" data-target="tfa--setup.canvas"></canvas>
<p>Secret: <%= current_user.tfa.secret %></p>
<p>Provisioning URI: <%= current_user.tfa.provisioning_uri %></p>
- <%= form_for current_user, url: tfa_path, method: :delete do |form| %>
+ <%= form_for current_user, url: my_mfa_path, method: :delete do |form| %>
<%= form.hidden_field :tfa_secret, data: { target: 'tfa--setup.secret' } %>
<%= form.submit "Disable", class: 'btn btn-danger', data: { disable_with: 'Saving…' } %>
<%= link_to "Cancel", my_dashboard_path, class: 'btn' %>
spec/requests/my/mfas_spec.rb
@@ -54,6 +54,7 @@ RSpec.describe '/my/mfa' do
specify { expect(current_user.reload.tfa_secret).to be_nil }
specify { expect(response).to redirect_to(my_dashboard_path) }
+ specify { expect(flash[:notice]).to include("MFA has been disabled") }
end
end
end