diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-12 13:50:40 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-12 13:50:40 +0000 |
commit | 9ea8dcb5e206bc9bf566ad2aebd167d20ec85531 (patch) | |
tree | 5c476f2e359053169b17ee4c38f51876e3e4ed97 /config | |
parent | c14de4fd28daf96ac01425f8c62e5acd15fe8e9f (diff) | |
parent | 1d080f57454fda46eb60700a8693cb968e6d557f (diff) | |
download | gitlab-ce-9ea8dcb5e206bc9bf566ad2aebd167d20ec85531.tar.gz |
Merge branch 'feature-session-expire-seconds-ui' into 'master'
Add session expiration delay configuration through UI application
Setting is accessible by the administrator through the UI and defaults to 1 week (the current setting)
Answers the following suggestions:
* http://feedback.gitlab.com/forums/176466-general/suggestions/6210719-make-session-length-configurable
* http://feedback.gitlab.com/forums/176466-general/suggestions/6730512-automatic-logout-after-a-time-being-idle
See merge request !774
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | config/initializers/session_store.rb | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index c2c3c5bfde7..9c622b73016 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -131,6 +131,7 @@ Settings.gitlab['issue_closing_pattern'] = '((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e Settings.gitlab['default_projects_features'] ||= {} Settings.gitlab['webhook_timeout'] ||= 10 Settings.gitlab['max_attachment_size'] ||= 10 +Settings.gitlab['session_expire_delay'] ||= 10080 Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil? Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil? Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil? diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index b2d59f1c4b7..43077fb575e 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,11 +1,15 @@ # Be sure to restart your server when you modify this file. +if ActiveRecord::Base.connection.active? && ActiveRecord::Base.connection.table_exists?('application_settings') + Settings.gitlab['session_expire_delay'] = ApplicationSetting.current.session_expire_delay +end + Gitlab::Application.config.session_store( :redis_store, # Using the cookie_store would enable session replay attacks. servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store key: '_gitlab_session', secure: Gitlab.config.gitlab.https, httponly: true, - expire_after: 1.week, + expire_after: Settings.gitlab['session_expire_delay'] * 60, path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root -) +)
\ No newline at end of file |