Files
fizzy/app/controllers/sessions/magic_links_controller.rb
T
Stanko Krtalić 98755844a1 Remove the internal API
* Bind sessions to identities
* Remove references to the identity token
* Move email changes to identity
* Move account menu into a turbo-frame
* Create tenants from a tenanted route
2025-10-31 16:26:08 +01:00

25 lines
591 B
Ruby

class Sessions::MagicLinksController < ApplicationController
require_untenanted_access
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