2025-09-30 12:43:26 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class Users::SessionsController < Devise::SessionsController
|
|
|
|
|
before_action :load_invitation_context, only: [:new]
|
|
|
|
|
|
|
|
|
|
def new
|
|
|
|
|
super
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def load_invitation_context
|
|
|
|
|
return unless invitation_token.present?
|
|
|
|
|
|
2025-10-07 12:38:06 -04:00
|
|
|
@invitation = Family::Invitation.find_by(token: invitation_token)
|
2025-10-22 15:36:51 -04:00
|
|
|
# Store token in session so it persists through the sign-in process
|
|
|
|
|
session[:invitation_token] = invitation_token if invitation_token.present?
|
2025-09-30 12:43:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def invitation_token
|
|
|
|
|
@invitation_token ||= params[:invitation_token] || session[:invitation_token]
|
|
|
|
|
end
|
2025-10-04 16:39:47 -04:00
|
|
|
end
|