21 lines
629 B
Ruby
21 lines
629 B
Ruby
class MfasController < ApplicationController
|
|
def new
|
|
issuer = "Hidden Agenda Email"
|
|
label = "#{issuer}:#{current_user.email}"
|
|
current_user.otp_secret = User.generate_otp_secret
|
|
current_user.save!
|
|
|
|
qrcode = RQRCode::QRCode.new([{ data: current_user.otp_provisioning_uri(label, issuer: issuer), mode: :byte_8bit }])
|
|
|
|
@svg = qrcode.as_svg(color: "000", shape_rendering: "crispEdges", module_size: 5, standalone: true,
|
|
use_path: true
|
|
)
|
|
end
|
|
|
|
def create
|
|
current_user.otp_required_for_login = true
|
|
current_user.save!
|
|
redirect_to root_url
|
|
end
|
|
end
|