Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit fe81806

Browse files
committed
New config to skip XMLRPC check for site discovery
1 parent 8ded346 commit fe81806

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public struct WordPressAuthenticatorConfiguration {
132132
///
133133
let wpcomPasswordInstructions: String?
134134

135+
/// If enabled, site discovery will not check for XMLRPC URL.
136+
///
137+
let skipXMLRPCCheckForSiteDiscovery: Bool
138+
135139
/// Designated Initializer
136140
///
137141
public init (wpcomClientId: String,
@@ -161,7 +165,8 @@ public struct WordPressAuthenticatorConfiguration {
161165
enableSiteCreation: Bool = false,
162166
enableSocialLogin: Bool = false,
163167
emphasizeEmailForWPComPassword: Bool = false,
164-
wpcomPasswordInstructions: String? = nil) {
168+
wpcomPasswordInstructions: String? = nil,
169+
skipXMLRPCCheckForSiteDiscovery: Bool = false) {
165170

166171
self.wpcomClientId = wpcomClientId
167172
self.wpcomSecret = wpcomSecret
@@ -191,5 +196,6 @@ public struct WordPressAuthenticatorConfiguration {
191196
self.enableSocialLogin = enableSocialLogin
192197
self.emphasizeEmailForWPComPassword = emphasizeEmailForWPComPassword
193198
self.wpcomPasswordInstructions = wpcomPasswordInstructions
199+
self.skipXMLRPCCheckForSiteDiscovery = skipXMLRPCCheckForSiteDiscovery
194200
}
195201
}

WordPressAuthenticator/Unified Auth/View Related/Site Address/SiteAddressViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class SiteAddressViewController: LoginViewController {
3131
/// Whether the protocol method `troubleshootSite` should be triggered after site info is fetched.
3232
///
3333
private let isSiteDiscovery: Bool
34+
private let configuration = WordPressAuthenticator.shared.configuration
3435

3536
init?(isSiteDiscovery: Bool, coder: NSCoder) {
3637
self.isSiteDiscovery = isSiteDiscovery
@@ -442,6 +443,11 @@ private extension SiteAddressViewController {
442443
// Checks that the site exists
443444
checkSiteExistence(url: url) { [weak self] in
444445
guard let self = self else { return }
446+
// skips XMLRPC check for site discovery if needed
447+
if self.isSiteDiscovery && self.configuration.skipXMLRPCCheckForSiteDiscovery {
448+
self.fetchSiteInfo()
449+
return
450+
}
445451
// Proceeds to check for the site's WordPress
446452
self.guessXMLRPCURL(for: self.loginFields.siteAddress)
447453
}

0 commit comments

Comments
 (0)