summaryrefslogtreecommitdiff
path: root/lib/action
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action')
-rw-r--r--lib/action/api_2fa_recovery.rb12
-rw-r--r--lib/action/git_lfs_authenticate.rb10
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/action/api_2fa_recovery.rb b/lib/action/api_2fa_recovery.rb
index 5597ff0..ad8130f 100644
--- a/lib/action/api_2fa_recovery.rb
+++ b/lib/action/api_2fa_recovery.rb
@@ -3,8 +3,8 @@ require_relative '../gitlab_logger'
module Action
class API2FARecovery < Base
- def initialize(key)
- @key = key
+ def initialize(actor)
+ @actor = actor
end
def execute(_, _)
@@ -13,7 +13,7 @@ module Action
private
- attr_reader :key
+ attr_reader :actor
def continue?(question)
puts "#{question} (yes/no)"
@@ -34,10 +34,10 @@ module Action
return
end
- resp = api.two_factor_recovery_codes(key.key_id)
+ resp = api.two_factor_recovery_codes(self)
if resp['success']
codes = resp['recovery_codes'].join("\n")
- $logger.info('API 2FA recovery success', user: key.log_username)
+ $logger.info('API 2FA recovery success', user: actor.log_username)
puts "Your two-factor authentication recovery codes are:\n\n" \
"#{codes}\n\n" \
"During sign in, use one of the codes above when prompted for\n" \
@@ -45,7 +45,7 @@ module Action
"a new device so you do not lose access to your account again."
true
else
- $logger.info('API 2FA recovery error', user: key.log_username)
+ $logger.info('API 2FA recovery error', user: actor.log_username)
puts "An error occurred while trying to generate new recovery codes.\n" \
"#{resp['message']}"
end
diff --git a/lib/action/git_lfs_authenticate.rb b/lib/action/git_lfs_authenticate.rb
index 218c71e..d2e6d76 100644
--- a/lib/action/git_lfs_authenticate.rb
+++ b/lib/action/git_lfs_authenticate.rb
@@ -3,15 +3,15 @@ require_relative '../gitlab_logger'
module Action
class GitLFSAuthenticate < Base
- def initialize(key, repo_name)
- @key = key
+ def initialize(actor, repo_name)
+ @actor = actor
@repo_name = repo_name
end
def execute(_, _)
GitlabMetrics.measure('lfs-authenticate') do
- $logger.info('Processing LFS authentication', user: key.log_username)
- lfs_access = api.lfs_authenticate(key.key_id, repo_name)
+ $logger.info('Processing LFS authentication', user: actor.log_username)
+ lfs_access = api.lfs_authenticate(self, repo_name)
return unless lfs_access
puts lfs_access.authentication_payload
@@ -21,6 +21,6 @@ module Action
private
- attr_reader :key, :repo_name
+ attr_reader :actor, :repo_name
end
end