Files
fizzy/app/controllers/sessions/magic_links_controller.rb
T
Mike Dalessio 89d1299ec0 Fix authentication on "untenanted" controllers
trying out the name "disallow_account_scope" for this, but I don't
think it's quite right yet.
2025-11-17 09:11:47 -05:00

25 lines
588 B
Ruby

class Sessions::MagicLinksController < ApplicationController
disallow_account_scope
require_unauthenticated_access
rate_limit to: 10, within: 15.minutes, only: :create, with: -> { redirect_to session_magic_link_path, alert: "Try again in 15 minutes." }
layout "public"
def show
end
def create
if identity = MagicLink.consume(code)
start_new_session_for identity
redirect_to after_authentication_url
else
redirect_to session_magic_link_path, alert: "Try another code."
end
end
private
def code
params.expect(:code)
end
end