Sha256: 1f5bd6e819b7ede4c143343db2e6515c25db32ac010f3f6555a2c7073565d558

Contents?: true

Size: 758 Bytes

Versions: 131

Compression:

Stored size: 758 Bytes

Contents

class Account::TwoFactorsController < Account::ApplicationController
  before_action :authenticate_user!

  def verify
    @user = current_user

    otp_code = params["user"]["otp_attempt"]
    @verified = current_user.validate_and_consume_otp!(otp_code)

    if @verified
      current_user.update(otp_required_for_login: true)
    else
      current_user.update(
        otp_required_for_login: false,
        otp_secret: nil
      )
    end
  end

  def create
    @backup_codes = current_user.generate_otp_backup_codes!
    @user = current_user

    current_user.update(otp_secret: User.generate_otp_secret)
  end

  def destroy
    @user = current_user
    current_user.update(
      otp_required_for_login: false,
      otp_secret: nil
    )
  end
end

Version data entries

131 entries across 131 versions & 1 rubygems

Version Path
bullet_train-1.14.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.13.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.12.3 app/controllers/account/two_factors_controller.rb
bullet_train-1.12.2 app/controllers/account/two_factors_controller.rb
bullet_train-1.12.1 app/controllers/account/two_factors_controller.rb
bullet_train-1.12.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.11.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.10.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.9.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.5 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.4 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.3 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.2 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.1 app/controllers/account/two_factors_controller.rb
bullet_train-1.8.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.7.23 app/controllers/account/two_factors_controller.rb
bullet_train-1.7.22 app/controllers/account/two_factors_controller.rb
bullet_train-1.7.21 app/controllers/account/two_factors_controller.rb
bullet_train-1.7.20 app/controllers/account/two_factors_controller.rb
bullet_train-1.7.19 app/controllers/account/two_factors_controller.rb