From d0cc9654f2f310f1256e755129daa5ff9f77906d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 24 Sep 2020 20:20:01 -0500 Subject: [PATCH] Don't allow duplicate accounts to be added for Feedbin, FeedWrangler, or NewsBlur. Issue #2448 --- .../Accounts/AccountsFeedbinWindowController.swift | 5 +++++ .../Accounts/AccountsNewsBlurWindowController.swift | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift b/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift index 711ab2758..e6598cd5a 100644 --- a/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift @@ -58,6 +58,11 @@ class AccountsFeedbinWindowController: NSWindowController { return } + guard !AccountManager.shared.duplicateServiceAccount(type: .feedbin, username: usernameTextField.stringValue) else { + self.errorMessageLabel.stringValue = NSLocalizedString("There is already a Feedbin account with that username created.", comment: "Duplicate Error") + return + } + actionButton.isEnabled = false progressIndicator.isHidden = false progressIndicator.startAnimation(self) diff --git a/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift b/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift index d1b1a2bb8..723e254d1 100644 --- a/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsNewsBlurWindowController.swift @@ -55,7 +55,12 @@ class AccountsNewsBlurWindowController: NSWindowController { self.errorMessageLabel.stringValue = NSLocalizedString("Username required.", comment: "Credentials Error") return } - + + guard !AccountManager.shared.duplicateServiceAccount(type: .newsBlur, username: usernameTextField.stringValue) else { + self.errorMessageLabel.stringValue = NSLocalizedString("There is already a NewsBlur account with that username created.", comment: "Duplicate Error") + return + } + actionButton.isEnabled = false progressIndicator.isHidden = false progressIndicator.startAnimation(self)