Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-30 23:39:56 +0300
committerStan Hu <stanhu@gmail.com>2018-09-04 08:37:36 +0300
commitb9cee4ba3c5e22766de771edde2b8d523ee84993 (patch)
tree8cfdcb02f48d8ccf1b15e55069829c0d2d4d045d /app/helpers/cookies_helper.rb
parentba99dfcde262c91e33b5bf7f86ba7c0e3b6f7e52 (diff)
Set issuable_sort and diff_view cookies to secure when possible
Closes #49120
Diffstat (limited to 'app/helpers/cookies_helper.rb')
-rw-r--r--app/helpers/cookies_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/cookies_helper.rb b/app/helpers/cookies_helper.rb
new file mode 100644
index 00000000000..3a7e9987190
--- /dev/null
+++ b/app/helpers/cookies_helper.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module CookiesHelper
+ def set_secure_cookie(key, value, httponly: false, permanent: false)
+ cookie_jar = permanent ? cookies.permanent : cookies
+
+ cookie_jar[key] = { value: value, secure: Gitlab.config.gitlab.https, httponly: httponly }
+ end
+end