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.4.7 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.6 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.5 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.4 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.3 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.2 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.1 app/controllers/account/two_factors_controller.rb
bullet_train-1.4.0 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.25 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.24 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.23 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.22 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.21 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.20 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.19 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.18 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.17 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.16 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.15 app/controllers/account/two_factors_controller.rb
bullet_train-1.3.14 app/controllers/account/two_factors_controller.rb