gitlab-org--gitlab-foss/app/controllers/profiles/two_factor_auths_controller.rb
2015-05-09 17:31:10 -04:00

22 lines
593 B
Ruby

class Profiles::TwoFactorAuthsController < ApplicationController
def new
issuer = "GitLab | #{current_user.email}"
uri = current_user.otp_provisioning_uri(current_user.email, issuer: issuer)
@qr_code = RQRCode::render_qrcode(uri, :svg, level: :l, unit: 2)
end
def create
current_user.otp_required_for_login = true
current_user.otp_secret = User.generate_otp_secret
current_user.save!
redirect_to profile_account_path
end
def destroy
current_user.otp_required_for_login = false
current_user.save!
redirect_to profile_account_path
end
end