-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authentication: Addressing Debt #1202
Changes from all commits
c41d64d
d41677e
20781d4
275b492
5cbb302
7e5a60a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ extension AuthViewController { | |
simplenoteTitleView.stringValue = "Simplenote" | ||
simplenoteSubTitleView.textColor = .simplenoteGray50Color | ||
simplenoteSubTitleView.stringValue = NSLocalizedString("The simplest way to keep notes.", comment: "Simplenote subtitle") | ||
|
||
// Error Label | ||
errorField.stringValue = "" | ||
errorField.textColor = .red | ||
|
@@ -93,18 +94,14 @@ extension AuthViewController { | |
|
||
@objc | ||
var usernameText: String { | ||
usernameField.stringValue?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" | ||
state.username | ||
} | ||
|
||
@objc | ||
var passwordText: String { | ||
passwordField.stringValue?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" | ||
state.password | ||
} | ||
|
||
var authWindowController: AuthWindowController? { | ||
view.window?.windowController as? AuthWindowController | ||
} | ||
|
||
/// # All of the Action Views | ||
/// | ||
private var allActionViews: [NSButton] { | ||
|
@@ -234,11 +231,6 @@ extension AuthViewController { | |
// MARK: - Handlers | ||
// | ||
extension AuthViewController { | ||
|
||
@IBAction | ||
func switchToPasswordAuth(_ sender: Any) { | ||
mode = AuthenticationMode.loginWithPassword | ||
} | ||
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 one wasn't in use |
||
|
||
@objc | ||
func performSignupRequest() { | ||
|
@@ -255,7 +247,7 @@ extension AuthViewController { | |
case .success: | ||
self.presentSignupVerification(email: email) | ||
case .failure(let result): | ||
self.showAuthenticationError(forCode: result.statusCode, responseString: result.response) | ||
self.showAuthenticationError(statusCode: result.statusCode, responseString: result.response) | ||
} | ||
|
||
self.stopActionAnimation() | ||
|
@@ -271,7 +263,7 @@ extension AuthViewController { | |
} | ||
|
||
@MainActor | ||
func performLoginWithEmailRequestInTask() async { | ||
private func performLoginWithEmailRequestInTask() async { | ||
defer { | ||
stopActionAnimation() | ||
setInterfaceEnabled(true) | ||
|
@@ -290,7 +282,7 @@ extension AuthViewController { | |
} catch { | ||
// TODO: Once Xcode 16 goes GM, *please* wire Typed Errors here? (it'll always be a RemoteError instance) | ||
let remoteError = error as? RemoteError | ||
self.showAuthenticationError(forCode: remoteError?.statusCode ?? .zero, responseString: remoteError?.response) | ||
self.showAuthenticationError(statusCode: remoteError?.statusCode ?? .zero, responseString: remoteError?.response) | ||
} | ||
} | ||
|
||
|
@@ -318,7 +310,7 @@ extension AuthViewController { | |
} catch { | ||
// TODO: Once Xcode 16 goes GM, *please* wire Typed Errors here? (it'll always be a RemoteError instance) | ||
let remoteError = error as? RemoteError | ||
self.showAuthenticationError(forCode: remoteError?.statusCode ?? .zero, responseString: remoteError?.response) | ||
self.showAuthenticationError(statusCode: remoteError?.statusCode ?? .zero, responseString: remoteError?.response) | ||
} | ||
} | ||
|
||
|
@@ -367,9 +359,9 @@ extension AuthViewController { | |
|
||
switch superView { | ||
case usernameField: | ||
state.username = usernameField.stringValue | ||
state.username = usernameField.stringValue.trimmingCharacters(in: .whitespacesAndNewlines) | ||
case passwordField: | ||
state.password = passwordField.stringValue | ||
state.password = passwordField.stringValue.trimmingCharacters(in: .whitespacesAndNewlines) | ||
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. Legacy |
||
case codeTextField: | ||
state.code = codeTextField.stringValue | ||
default: | ||
|
@@ -405,17 +397,9 @@ extension AuthViewController { | |
let vc = SignupVerificationViewController(email: email, authenticator: authenticator) | ||
view.window?.transition(to: vc) | ||
} | ||
|
||
//TODO: Drop this method? | ||
func presentMagicLinkRequestedView(email: String) { | ||
guard let authWindowController else { | ||
return | ||
} | ||
|
||
authWindowController.switchToMagicLinkRequestedUI(email: email) | ||
} | ||
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. Not in use any longer! |
||
} | ||
|
||
|
||
// MARK: - Login Error Handling | ||
// | ||
extension AuthViewController { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,5 @@ | |
- (void)presentPasswordResetAlert; | ||
- (void)presentPasswordCompromisedAlert; | ||
- (void)presentUnverifiedEmailAlert; | ||
- (void)showAuthenticationErrorForCode:(NSInteger)responseCode responseString:(NSString *)responseString; | ||
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 was triggering a warning. I've missed dropping the forward declaration, when ported to Swift |
||
|
||
@end |
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.
👋 too!!