diff options
author | Vitaliy Serov <[email protected]> | 2024-02-01 19:20:15 +0200 |
---|---|---|
committer | git <[email protected]> | 2024-02-02 19:26:58 +0000 |
commit | 0bcad50c8c9655118401ced990d977d8cf9392ff (patch) | |
tree | f7eb036bfcee4f0aa534838d0f57e9941b2ed01b /lib | |
parent | 064f251571f6d96ff3edcd81e6743eb617f66db9 (diff) |
[rubygems/rubygems] Fix var name and also update other places
https://github.com/rubygems/rubygems/commit/f72a7989cd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index de617ccc9f..ba356bc38c 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -130,12 +130,12 @@ module Gem::GemcutterUtilities say "The existing key doesn't have access of #{scope} on #{pretty_host}. Please sign in to update access." - email = ask "Username/email: " - password = ask_for_password " Password: " + identifier = ask "Username/email: " + password = ask_for_password " Password: " response = rubygems_api_request(:put, "api/v1/api_key", sign_in_host, scope: scope) do |request| - request.basic_auth email, password + request.basic_auth identifier, password request["OTP"] = otp if otp request.body = Gem::URI.encode_www_form({ api_key: api_key }.merge(update_scope_params)) end @@ -159,23 +159,23 @@ module Gem::GemcutterUtilities say "Don't have an account yet? " \ "Create one at #{sign_in_host}/sign_up" - email = ask " Email: " - password = ask_for_password "Password: " + identifier = ask "Username/email: " + password = ask_for_password " Password: " say "\n" key_name = get_key_name(scope) scope_params = get_scope_params(scope) - profile = get_user_profile(email, password) + profile = get_user_profile(identifier, password) mfa_params = get_mfa_params(profile) all_params = scope_params.merge(mfa_params) warning = profile["warning"] - credentials = { email: email, password: password } + credentials = { identifier: identifier, password: password } say "#{warning}\n" if warning response = rubygems_api_request(:post, "api/v1/api_key", sign_in_host, credentials: credentials, scope: scope) do |request| - request.basic_auth email, password + request.basic_auth identifier, password request["OTP"] = otp if otp request.body = Gem::URI.encode_www_form({ name: key_name }.merge(all_params)) end @@ -295,7 +295,7 @@ module Gem::GemcutterUtilities if credentials.empty? request.add_field "Authorization", api_key else - request.basic_auth credentials[:email], credentials[:password] + request.basic_auth credentials[:identifier], credentials[:password] end end response.is_a?(Gem::Net::HTTPSuccess) ? response.body : nil @@ -346,11 +346,11 @@ module Gem::GemcutterUtilities host == Gem::DEFAULT_HOST end - def get_user_profile(email, password) + def get_user_profile(identifier, password) return {} unless default_host? response = rubygems_api_request(:get, "api/v1/profile/me.yaml") do |request| - request.basic_auth email, password + request.basic_auth identifier, password end with_response response do |resp| |