Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simply OTP method selection #453

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions app/controllers/concerns/otp_delivery_fallback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ def sms_enabled?

def current_otp_method
query_method = params[:otp_method]
query_method.to_sym if
%w(sms voice totp).include? query_method
end

def use_sms_or_voice_otp_delivery?
%i(sms voice).include? current_otp_method
return query_method.to_sym if %w(sms voice totp rescue_code).include? query_method
return :totp if current_user.totp_enabled?
return :sms
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def new
end

def show
if use_totp?
if current_otp_method == :totp
show_totp_prompt
else
@phone_number = user_decorator.masked_two_factor_phone_number
Expand Down Expand Up @@ -53,12 +53,6 @@ def check_already_authenticated
redirect_to profile_path if user_fully_authenticated?
end

def use_totp?
# Present the TOTP entry screen to users who are TOTP enabled,
# unless the user explictly selects SMS or voice
current_user.totp_enabled? && !use_sms_or_voice_otp_delivery?
end

def verify_user_is_not_second_factor_locked
handle_second_factor_locked_resource if user_decorator.blocked_from_entering_2fa_code?
end
Expand Down