Redirect to the account you joined after sign in
This commit is contained in:
@@ -2,6 +2,7 @@ class JoinCodesController < ApplicationController
|
||||
require_untenanted_access
|
||||
allow_unauthenticated_access
|
||||
before_action :set_join_code
|
||||
before_action :ensure_join_code_is_valid
|
||||
|
||||
def new
|
||||
@account_name = ApplicationRecord.with_tenant(tenant) { Account.sole.name }
|
||||
@@ -14,10 +15,15 @@ class JoinCodesController < ApplicationController
|
||||
identity.send_magic_link
|
||||
end
|
||||
|
||||
session[:return_to_after_authenticating] = root_url(script_name: "/#{tenant}")
|
||||
redirect_to session_magic_link_path
|
||||
end
|
||||
|
||||
private
|
||||
def ensure_join_code_is_valid
|
||||
head :not_found unless @join_code&.active?
|
||||
end
|
||||
|
||||
def set_join_code
|
||||
@join_code ||= ApplicationRecord.with_tenant(tenant) { Account::JoinCode.active.find_by(code: code) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user