summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
authorDrew Blessing <drew@gitlab.com>2016-08-20 13:07:00 -0500
committerDrew Blessing <drew@gitlab.com>2016-08-26 15:10:31 -0500
commitdcc20876554ae18c6869b80071728f1b91858c5f (patch)
tree5e5dc709238c54a8e5213cd11f577751fc744ef8 /lib/gitlab_net.rb
parent3043b31c458bf720843a84b35c9fbad5c1488c1d (diff)
downloadgitlab-shell-dcc20876554ae18c6869b80071728f1b91858c5f.tar.gz
Add option to recover 2FA via SSH
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index 35a8833..47bae95 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -72,6 +72,15 @@ class GitlabNet
nil
end
+ def two_factor_recovery_codes(key)
+ key_id = key.gsub('key-', '')
+ resp = post("#{host}/two_factor_recovery_codes", key_id: key_id)
+
+ JSON.parse(resp.body) if resp.code == '200'
+ rescue
+ {}
+ end
+
def redis_client
redis_config = config.redis
database = redis_config['database'] || 0