config: add option for customizing session cookie name.
Fixes getting logged out when you visited Testbooru because of Testbooru's session cookies clobbering Danbooru's session cookies.
This commit is contained in:
@@ -46,6 +46,12 @@ module Danbooru
|
|||||||
"DanbooruBot"
|
"DanbooruBot"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The name of the cookie that stores the current user's login session.
|
||||||
|
# Changing this will force all users to login again.
|
||||||
|
def session_cookie_name
|
||||||
|
"_danbooru2_session"
|
||||||
|
end
|
||||||
|
|
||||||
def source_code_url
|
def source_code_url
|
||||||
"https://github.com/danbooru/danbooru"
|
"https://github.com/danbooru/danbooru"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
Rails.application.config.session_store :cookie_store, key: '_danbooru2_session', domain: :all, tld_length: 2, same_site: :lax, secure: Rails.env.production?
|
# https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html
|
||||||
|
Rails.application.config.session_store(
|
||||||
|
:cookie_store,
|
||||||
|
key: Danbooru.config.session_cookie_name,
|
||||||
|
domain: :all,
|
||||||
|
tld_length: 2,
|
||||||
|
same_site: :lax,
|
||||||
|
secure: Rails.env.production?
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user