You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
909 B
33 lines
909 B
class Auth::TwoFactorAuthenticationController < Devise::TwoFactorAuthenticationController |
|
def show_resend |
|
render "devise/two_factor_authentication/resend" |
|
end |
|
|
|
def update |
|
resource.errors.add :base, I18n.t("devise.two_factor_authentication.code_required") if resource && params_code.empty? |
|
super |
|
end |
|
|
|
private |
|
|
|
def after_two_factor_fail_for(resource) |
|
resource.second_factor_attempts_count += 1 |
|
resource.save! |
|
|
|
if resource.max_login_attempts? |
|
sign_out(resource) |
|
render :max_login_attempts_reached, status: :unprocessable_entity |
|
else |
|
resource.errors.add :base, I18n.t("devise.two_factor_authentication.code_incorrect") if resource |
|
render :show, status: :unprocessable_entity |
|
end |
|
end |
|
|
|
def after_two_factor_success_path_for(resource) |
|
if resource.is_a?(User) && resource.support? |
|
"/organisations" |
|
else |
|
super |
|
end |
|
end |
|
end
|
|
|