I do believe that OTP/MFA is now working.
This commit is contained in:
20
app/controllers/mfas_controller.rb
Normal file
20
app/controllers/mfas_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user