Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -520,6 +521,7 @@ private extension GetStartedViewController {
return
}

vc.source = source
vc.loginFields = loginFields
vc.trackAsPasswordChallenge = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class PasswordViewController: LoginViewController {
///
var trackAsPasswordChallenge = true

var source: SignInSource?

override var loginFields: LoginFields {
didSet {
loginFields.password = ""
Expand Down Expand Up @@ -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 {

Expand Down