Skip to content

Commit

Permalink
Rubocop, tests passing?
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlinxc committed Jun 13, 2022
1 parent 25da8ca commit 87edf77
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/controllers/multifactor_auths_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ def seed_and_expire
end

def handle_new_level_param
if level_param == "disabled"
case level_param
when "disabled"
flash[:success] = t("multifactor_auths.destroy.success")
current_user.disable_mfa!
elsif level_param == "ui_only"
when "ui_only"
flash[:error] = t("multifactor_auths.ui_only_warning")
else
flash[:error] = t(".success")
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ def edit
@mfa_options = [
[t(".mfa.level.ui_and_api"), "ui_and_api"],
[t(".mfa.level.ui_and_gem_signin"), "ui_and_gem_signin"],
[t(".mfa.level.disabled"), "disabled"]]
if @user.mfa_ui_only?
@mfa_options.insert(2, [t(".mfa.level.ui_only"), "ui_only"])
end
[t(".mfa.level.disabled"), "disabled"]
]
@mfa_options.insert(2, [t(".mfa.level.ui_only"), "ui_only"]) if @user.mfa_ui_only?
end
end
4 changes: 2 additions & 2 deletions test/functional/multifactor_auths_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ class MultifactorAuthsControllerTest < ActionController::TestCase
should redirect_to("the settings page") { edit_settings_path }

should "set flash" do
assert_equal flash[:error], "UI Only is deprecated. We encourage you to change your MFA level to \"UI and gem signin\" or \"UI and API\"."
assert_equal("UI Only is deprecated. We encourage you to change your MFA level to \"UI and gem signin\" or \"UI and API\".",
flash[:error])
end

should "mfa level should be same as before" do
assert_predicate @user.reload, :mfa_ui_and_api?
end

end

context "on updating to ui_and_api" do
Expand Down

0 comments on commit 87edf77

Please sign in to comment.