spaceship 0.11.4 → 0.11.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 573cfe1106b081189c609f460d4faf09ddf544bd
4
- data.tar.gz: 3066593ad3d06583a4fba5d818de9125a22fdc8c
3
+ metadata.gz: 7892cbc5a93927bef1d796eb45fc84c1017dc1dc
4
+ data.tar.gz: df314307a70c527c622414cdcde805c0ab3c273f
5
5
  SHA512:
6
- metadata.gz: f97841711348281ba089286fa7930934f005ee26da88c39e228c4624641c0d6d064938bca5a1709e92624d522e84280c3fff0937ee909b57d5d1ed7b74d0ab96
7
- data.tar.gz: f1a581473976d86d81b7c55685efb51690b3348e7eabf9545c10041fe968de166859157df6c54cc27c8655f024ff5a5c681123f7773be54cbdb141b1137a5ed4
6
+ metadata.gz: 347d01092e1fcd5c0f5ac9de94bb2da604224fb022a7840ff8f7c0549ac547f75a6e07b7a85dc9bcfe0a6ba9fcdbba8c2e10e73a7933df3e0d4080ba80c6e9d2
7
+ data.tar.gz: e545770c5d1e129f3b85ebf6240ffa2b1730c106b4143a0700ce4f4828d5ee9e59fc5dd0e261e720edc5a9e6584f68eee8d735fc1ae44b43456d522fd657bfba
@@ -142,9 +142,9 @@ module Spaceship
142
142
  if user.to_s.empty? or password.to_s.empty?
143
143
  require 'credentials_manager'
144
144
 
145
- data = CredentialsManager::AccountManager.new(user: user, password: password)
146
- user ||= data.user
147
- password = data.password
145
+ keychain_entry = CredentialsManager::AccountManager.new(user: user, password: password)
146
+ user ||= keychain_entry.user
147
+ password = keychain_entry.password
148
148
  end
149
149
 
150
150
  if user.to_s.strip.empty? or password.to_s.strip.empty?
@@ -152,7 +152,18 @@ module Spaceship
152
152
  end
153
153
 
154
154
  self.user = user
155
- send_login_request(user, password) # different in subclasses
155
+
156
+ begin
157
+ send_login_request(user, password) # different in subclasses
158
+ rescue InvalidUserCredentialsError => ex
159
+ raise ex unless keychain_entry
160
+
161
+ if keychain_entry.invalid_credentials
162
+ login(user)
163
+ else
164
+ puts "Please run this tool again to apply the new password"
165
+ end
166
+ end
156
167
  end
157
168
 
158
169
  # @return (Bool) Do we have a valid session?
@@ -41,8 +41,14 @@ module Spaceship
41
41
  @cookie = "myacinfo=#{$1};"
42
42
  return @client
43
43
  else
44
- # User Credentials are wrong
45
- raise InvalidUserCredentialsError.new, response
44
+ # Something went wrong. Was it invalid credentials or server issue
45
+ if (response.body || "").include?("Your Apple ID or password was entered incorrectly")
46
+ # User Credentials are wrong
47
+ raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
48
+ else
49
+ info = [response.body, response['Set-Cookie']]
50
+ raise UnexpectedResponse.new, info.join("\n")
51
+ end
46
52
  end
47
53
  end
48
54
 
@@ -88,7 +88,7 @@ module Spaceship
88
88
 
89
89
  return @client
90
90
  else
91
- if (response.body || "").include?("You have successfully signed out")
91
+ if (response.body || "").include?("Your Apple ID or password was entered incorrectly")
92
92
  # User Credentials are wrong
93
93
  raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
94
94
  else
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.11.4"
2
+ VERSION = "0.11.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spaceship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-08 00:00:00.000000000 Z
12
+ date: 2015-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.8.1
20
+ version: 0.9.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.8.1
27
+ version: 0.9.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: multi_xml
30
30
  requirement: !ruby/object:Gem::Requirement