This repository was archived by the owner on Feb 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Fix Google 2FA login #157
Merged
Merged
Fix Google 2FA login #157
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
04687df
Moving Google sign in methods to LoginViewController.
ScoutHarris 8e36c41
Updating VCs to use Google sign in methods in LoginViewController.
ScoutHarris 1905121
Updating Google login presented from the prologue to use the Google s…
ScoutHarris 3bfb263
Moving strings to an enum.
ScoutHarris 9221d53
Removing comment.
ScoutHarris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ import UIKit | |
| import Lottie | ||
| import WordPressShared | ||
| import WordPressUI | ||
| import GoogleSignIn | ||
| import WordPressKit | ||
|
|
||
| class LoginPrologueViewController: LoginViewController { | ||
|
|
||
|
|
@@ -56,18 +58,18 @@ class LoginPrologueViewController: LoginViewController { | |
| } | ||
| vc.modalPresentationStyle = .custom | ||
| } | ||
|
|
||
| else if let vc = segue.destination as? LoginPrologueLoginMethodViewController { | ||
| vc.transitioningDelegate = self | ||
|
|
||
| vc.emailTapped = { [weak self] in | ||
| self?.performSegue(withIdentifier: .showEmailLogin, sender: self) | ||
| } | ||
| vc.googleTapped = { [weak self] in | ||
| self?.performSegue(withIdentifier: .showGoogle, sender: self) | ||
| self?.googleLoginTapped(withDelegate: self) | ||
| } | ||
| vc.selfHostedTapped = { [weak self] in | ||
| self?.performSegue(withIdentifier: .showSelfHostedLogin, sender: self) | ||
| self?.loginToSelfHostedSite() | ||
| } | ||
| vc.appleTapped = { [weak self] in | ||
| self?.appleTapped() | ||
|
|
@@ -124,6 +126,8 @@ class LoginPrologueViewController: LoginViewController { | |
|
|
||
| } | ||
|
|
||
| // MARK: - AppleAuthenticatorDelegate | ||
|
|
||
| extension LoginPrologueViewController: AppleAuthenticatorDelegate { | ||
|
|
||
| func showWPComLogin(loginFields: LoginFields) { | ||
|
|
@@ -134,5 +138,37 @@ extension LoginPrologueViewController: AppleAuthenticatorDelegate { | |
| func authFailedWithError(message: String) { | ||
| displayErrorAlert(message, sourceTag: .loginApple) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // MARK: - Google Sign In | ||
|
|
||
| // LoginFacadeDelegate methods for Google Google Sign In | ||
| extension LoginPrologueViewController { | ||
|
|
||
| override open func displayRemoteError(_ error: Error) { | ||
| configureViewLoading(false) | ||
| displayRemoteErrorForGoogle(error) | ||
| } | ||
|
|
||
| func finishedLogin(withGoogleIDToken googleIDToken: String, authToken: String) { | ||
| googleFinishedLogin(withGoogleIDToken: googleIDToken, authToken: authToken) | ||
| } | ||
|
|
||
| func existingUserNeedsConnection(_ email: String) { | ||
| configureViewLoading(false) | ||
| googleExistingUserNeedsConnection(email) | ||
| } | ||
|
|
||
| func needsMultifactorCode(forUserID userID: Int, andNonceInfo nonceInfo: SocialLogin2FANonceInfo) { | ||
| configureViewLoading(false) | ||
| googleNeedsMultifactorCode(forUserID: userID, andNonceInfo: nonceInfo) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| extension LoginPrologueViewController: GIDSignInDelegate { | ||
| open func sign(_ signIn: GIDSignIn?, didSignInFor user: GIDGoogleUser?, withError error: Error?) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we name this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method belongs to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omg sorry 🙃 :homer-disappear: |
||
| signInGoogleAccount(signIn, didSignInFor: user, withError: error) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the error displayed here always a Google error? There was previously a check for
if awaitingGoogle... else– was the else case for non-Google errors?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see that the new method includes the
elsestatement!