amazon_auth 0.4.1 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -4
- data/Rakefile +1 -1
- data/amazon_auth.gemspec +0 -1
- data/exe/amazon_auth +2 -4
- data/lib/amazon_auth/extensions/common_extension.rb +0 -1
- data/lib/amazon_auth/extensions/session_extension.rb +22 -12
- data/lib/amazon_auth/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8bd3624417b3a13baad3a2812cf7bdc6f874966e69290b3e5dce2bfb748b4a9a
|
4
|
+
data.tar.gz: fff02f6937501b76a01d16a9de7b9ade90b02b2e4ac5de8448b58293a69b8579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dfdb0bf93116a962ab13314f7342837bb920371d35f9e0cb1ab26754d9b65d23237b2de6263d6621b2eb1dc3631f6ebe262c457695192882edf41d304090060
|
7
|
+
data.tar.gz: 3a72e83fc180ee2028b5b4b0382f0b290d631a233eb9aae4a71827c9eae7d90f91701b672c16a98066dcf7567c70aa27539faf6ec2c3e7c6ef2249af7549667b
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/amazon_auth.gemspec
CHANGED
data/exe/amazon_auth
CHANGED
@@ -3,12 +3,10 @@
|
|
3
3
|
require_relative "../lib/amazon_auth"
|
4
4
|
require 'highline/import'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
domain = ask("Enter your amazon domain: ") { |q| q.echo = true ; q.default = AmazonInfo.domain }
|
6
|
+
domain = ask("Enter your amazon domain: ") { |q| q.echo = true; q.default = AmazonInfo.domain }
|
9
7
|
login = ask("Enter your #{domain} username: ") { |q| q.echo = true }
|
10
8
|
passwd = ask("Enter your #{domain} password: ") { |q| q.echo = "*" }
|
11
|
-
salt = ask("Enter your salt: ") { |q| q.default = AmazonAuth::Converter.default_salt
|
9
|
+
salt = ask("Enter your salt: ") { |q| q.default = AmazonAuth::Converter.default_salt; q.echo = true }
|
12
10
|
|
13
11
|
raise "Empty login or password" if login.to_s.size == 0 || passwd.to_s.size == 0
|
14
12
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module AmazonAuth
|
2
2
|
module SessionExtension
|
3
|
-
|
4
3
|
def doc
|
5
4
|
Nokogiri.HTML(session.html)
|
6
5
|
end
|
@@ -12,7 +11,7 @@ module AmazonAuth
|
|
12
11
|
|
13
12
|
def wait_for_selector(selector, options = {})
|
14
13
|
options.fetch(:wait_time, 3).times do
|
15
|
-
if session.first(selector)
|
14
|
+
if session.first(selector, minimum: 0)
|
16
15
|
break
|
17
16
|
else
|
18
17
|
sleep(1)
|
@@ -30,7 +29,7 @@ module AmazonAuth
|
|
30
29
|
session.visit url
|
31
30
|
debug "Visiting #{url}"
|
32
31
|
restore_cookies if keep_cookie?
|
33
|
-
if (link = links_for('a').find{|
|
32
|
+
if (link = links_for('a').find{|l| l =~ %r{\A/gp/navigation/redirector.html} })
|
34
33
|
debug "link: [#{link}]"
|
35
34
|
session.visit(link)
|
36
35
|
end
|
@@ -50,12 +49,22 @@ module AmazonAuth
|
|
50
49
|
end
|
51
50
|
|
52
51
|
def submit_signin_form
|
52
|
+
# Click account switcher if it is displayed
|
53
|
+
dom_account_switcher = '.cvf-account-switcher-profile-details, .cvf-account-switcher-claim'
|
54
|
+
session.first(dom_account_switcher).click if session.has_selector?(dom_account_switcher)
|
55
|
+
|
53
56
|
debug "Begin submit_signin_form"
|
54
57
|
unless session.has_selector?('#signInSubmit')
|
55
|
-
|
56
|
-
|
58
|
+
if session.has_selector?('input#continue') && session.has_selector?('input#ap_email')
|
59
|
+
log "Found a form which asks only email"
|
60
|
+
session.fill_in 'ap_email', with: login
|
61
|
+
session.first('input#continue').click
|
62
|
+
else
|
63
|
+
log "signInSubmit button not found in this page"
|
64
|
+
return false
|
65
|
+
end
|
57
66
|
end
|
58
|
-
session.fill_in 'ap_email', with: login if session.first('#ap_email') && session.first('#ap_email').value.blank?
|
67
|
+
session.fill_in 'ap_email', with: login if session.first('#ap_email', minimum: 0) && session.first('#ap_email').value.blank?
|
59
68
|
session.fill_in 'ap_password', with: password
|
60
69
|
session.first('#signInSubmit').click
|
61
70
|
log "Clicked signInSubmit"
|
@@ -98,11 +107,12 @@ module AmazonAuth
|
|
98
107
|
|
99
108
|
private
|
100
109
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
110
|
+
def login
|
111
|
+
options.fetch(:login, Converter.decode(ENV['AMAZON_USERNAME_CODE']))
|
112
|
+
end
|
113
|
+
|
114
|
+
def password
|
115
|
+
options.fetch(:password, Converter.decode(ENV['AMAZON_PASSWORD_CODE']))
|
116
|
+
end
|
107
117
|
end
|
108
118
|
end
|
data/lib/amazon_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuho Yamaguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -196,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
|
200
|
-
rubygems_version: 2.6.13
|
199
|
+
rubygems_version: 3.0.8
|
201
200
|
signing_key:
|
202
201
|
specification_version: 4
|
203
202
|
summary: Login amazon.
|