diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 85088a1c9..01b0d0cbe 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressAuthenticator' - s.version = '2.1.0-beta.5' + s.version = '2.1.0-beta.6' s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.' s.description = <<-DESC diff --git a/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift b/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift index b988a30de..48f7e8390 100644 --- a/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift +++ b/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift @@ -13,6 +13,7 @@ public enum SignInSource { /// The error during the sign in flow. public enum SignInError: Error { case invalidWPComEmail(source: SignInSource) + case invalidWPComPassword(source: SignInSource) init?(error: Error, source: SignInSource?) { let error = error as NSError @@ -520,6 +521,7 @@ private extension GetStartedViewController { return } + vc.source = source vc.loginFields = loginFields vc.trackAsPasswordChallenge = false diff --git a/WordPressAuthenticator/Unified Auth/View Related/Password/PasswordViewController.swift b/WordPressAuthenticator/Unified Auth/View Related/Password/PasswordViewController.swift index 961564d15..a573fb899 100644 --- a/WordPressAuthenticator/Unified Auth/View Related/Password/PasswordViewController.swift +++ b/WordPressAuthenticator/Unified Auth/View Related/Password/PasswordViewController.swift @@ -21,6 +21,8 @@ class PasswordViewController: LoginViewController { /// var trackAsPasswordChallenge = true + var source: SignInSource? + override var loginFields: LoginFields { didSet { loginFields.password = "" @@ -121,6 +123,15 @@ class PasswordViewController: LoginViewController { let errorCode = nsError.code let errorDomain = nsError.domain + if let source = source, loginFields.meta.userIsDotCom { + let passwordError = SignInError.invalidWPComPassword(source: source) + if authenticationDelegate.shouldHandleError(passwordError) { + authenticationDelegate.handleError(passwordError) { _ in + // No custom navigation is expected in this case. + } + } + } + if errorDomain == WordPressComOAuthClient.WordPressComOAuthErrorDomain, errorCode == WordPressComOAuthError.invalidRequest.rawValue {