File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
WooCommerce/Classes/Authentication Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate {
372372 }
373373 } ( )
374374
375- // Only show the tutorial if the error can be solved by the app password flow.
375+ // Show the tutorial immediately if it's obvious that the error can be solved by the app password flow.
376376 if isAppPasswordAuthError {
377377 presentAppPasswordTutorial ( error: error, for: siteURL, in: viewController)
378378 } else {
@@ -798,10 +798,20 @@ private extension AuthenticationManager {
798798 /// Presents login error alert before redirecting user to the site login using a web view.
799799 ///
800800 private func presentAppPasswordAlert( error: Error , for siteURL: String , in viewController: UIViewController ) {
801-
801+ let shouldEnableWebFlow : Bool = {
802+ if let siteCredentialError = error as? SiteCredentialLoginError ,
803+ case . invalidCredentials = siteCredentialError {
804+ return true
805+ }
806+ return false
807+ } ( )
808+ let defaultAction = shouldEnableWebFlow ? { [ weak self] in
809+ guard let self else { return }
810+ presentApplicationPasswordWebView ( for: siteURL, in: viewController)
811+ } : nil
802812 let alertController = FancyAlertViewController . makeSiteCredentialLoginErrorAlert (
803813 message: ( error as NSError ) . localizedDescription,
804- defaultAction: nil
814+ defaultAction: defaultAction
805815 )
806816
807817 viewController. present ( alertController, animated: true )
You can’t perform that action at this time.
0 commit comments