1
0

challenges_controller.rb 588 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. class Auth::ChallengesController < ApplicationController
  3. include ChallengableConcern
  4. layout 'auth'
  5. before_action :authenticate_user!
  6. skip_before_action :check_self_destruct!
  7. skip_before_action :require_functional!
  8. def create
  9. if challenge_passed?
  10. session[:challenge_passed_at] = Time.now.utc
  11. redirect_to challenge_params[:return_to]
  12. else
  13. @challenge = Form::Challenge.new(return_to: challenge_params[:return_to])
  14. flash.now[:alert] = I18n.t('challenge.invalid_password')
  15. render_challenge
  16. end
  17. end
  18. end