I do believe that OTP/MFA is now working.

This commit is contained in:
2024-05-21 12:44:08 +01:00
parent 95675aa5ef
commit b72f88f60f
10 changed files with 65 additions and 6 deletions

View 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