Class: QuoVadis::RecoveryCodesController
- Inherits:
-
QuoVadisController
- Object
- ApplicationController
- QuoVadisController
- QuoVadis::RecoveryCodesController
- Defined in:
- app/controllers/quo_vadis/recovery_codes_controller.rb
Instance Method Summary collapse
Instance Method Details
#authenticate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/quo_vadis/recovery_codes_controller.rb', line 18 def authenticate if account.recovery_codes.detect { |rc| rc.authenticate_code params[:code] } qv.log account, Log::RECOVERY_CODE_SUCCESS qv.replace_session qv.session_authenticated_with_second_factor reset_totp redirect_to qv.path_after_authentication, notice: QuoVadis.translate('flash.recovery_code.success', count: account.recovery_codes.count) else qv.log account, Log::RECOVERY_CODE_FAILURE flash.now[:alert] = QuoVadis.translate('flash.recovery_code.unverified') render :challenge, status: :unprocessable_entity end end |
#challenge ⇒ Object
14 15 |
# File 'app/controllers/quo_vadis/recovery_codes_controller.rb', line 14 def challenge end |
#generate ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/quo_vadis/recovery_codes_controller.rb', line 35 def generate qv.log account, Log::RECOVERY_CODE_GENERATE QuoVadis.notify :recovery_codes_generation_notification, email: authenticated_model.email account.recovery_codes.delete_all flash[:recovery_codes] = account.generate_recovery_codes redirect_to quo_vadis.recovery_codes_path end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/quo_vadis/recovery_codes_controller.rb', line 8 def index @codes = flash[:recovery_codes] @recovery_code_count = account.recovery_codes.count end |