mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: add setting permanent_session_cookie to configure session stickiness
Now admins can turn make the login cookie die after the browser is closed, so the user needs to log in everytime.
This commit is contained in:
parent
dd0260e435
commit
09ef5f613e
3 changed files with 7 additions and 1 deletions
|
@ -66,7 +66,11 @@ class Auth::DefaultCurrentUserProvider
|
|||
user.auth_token = SecureRandom.hex(16)
|
||||
user.save!
|
||||
end
|
||||
cookies.permanent[TOKEN_COOKIE] = { value: user.auth_token, httponly: true }
|
||||
if SiteSetting.permanent_session_cookie
|
||||
cookies.permanent[TOKEN_COOKIE] = { value: user.auth_token, httponly: true }
|
||||
else
|
||||
cookies[TOKEN_COOKIE] = { value: user.auth_token, httponly: true }
|
||||
end
|
||||
make_developer_admin(user)
|
||||
enable_bootstrap_mode(user)
|
||||
@env[CURRENT_USER_KEY] = user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue