Skip to content

Commit

Permalink
Merge pull request #219 from TheM4hd1/development
Browse files Browse the repository at this point in the history
Fixed Login Error Parsing
  • Loading branch information
TheM4hd1 authored Nov 12, 2020
2 parents 3632af4 + 64b755b commit cc4baef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion SwiftyInsta.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SwiftyInsta"
s.version = "2.4"
s.version = "2.4.1"
s.summary = "Private and Tokenless Instagram RESTful API."

s.homepage = "https://github.com/TheM4hd1/SwiftyInsta"
Expand Down
29 changes: 17 additions & 12 deletions SwiftyInsta/API/Handlers/AuthenticationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,23 @@ final class AuthenticationHandler: Handler {
data: cookies.data)
// actually authenticate.
handler.authenticate(with: .cache(cache), completionHandler: completionHandler)
} else if response.invalidCredentials ?? false {
if let errorType = response.errorType {
if errorType.elementsEqual("invalid_user") {
user.response = .failure
handler.settings.queues.response.async {
completionHandler(.failure(AuthenticationError.invalidUsername))
}
} else {
user.response = .failure
handler.settings.queues.response.async {
completionHandler(.failure(AuthenticationError.invalidPassword))
}
} else {
user.response = .failure
handler.settings.queues.response.async {
completionHandler(.failure(GenericError.custom("Unknown error.")))
}
}
} else if response.invalidCredentials ?? false {
if let errorType = response.errorType {
if errorType.elementsEqual("invalid_user") {
user.response = .failure
handler.settings.queues.response.async {
completionHandler(.failure(AuthenticationError.invalidUsername))
}
} else {
user.response = .failure
handler.settings.queues.response.async {
completionHandler(.failure(AuthenticationError.invalidPassword))
}
}
}
Expand Down

0 comments on commit cc4baef

Please sign in to comment.