summaryrefslogtreecommitdiff
path: root/lib/gitlab/auth
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 09:09:23 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 09:09:23 +0000
commit4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4 (patch)
tree82591df15758864325897043f855b4e4dfcb6a56 /lib/gitlab/auth
parent0301a0cad0063d76b1607358dc6c711ea043fdda (diff)
downloadgitlab-ce-4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r--lib/gitlab/auth/key_status_checker.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/gitlab/auth/key_status_checker.rb b/lib/gitlab/auth/key_status_checker.rb
new file mode 100644
index 00000000000..af654c0caad
--- /dev/null
+++ b/lib/gitlab/auth/key_status_checker.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Auth
+ class KeyStatusChecker
+ include Gitlab::Utils::StrongMemoize
+
+ attr_reader :key
+
+ def initialize(key)
+ @key = key
+ end
+
+ def show_console_message?
+ console_message.present?
+ end
+
+ def console_message
+ strong_memoize(:console_message) do
+ if key.expired?
+ _('INFO: Your SSH key has expired. Please generate a new key.')
+ elsif key.expires_soon?
+ _('INFO: Your SSH key is expiring soon. Please generate a new key.')
+ end
+ end
+ end
+ end
+ end
+end