Store correct credentials for FreshRSS

This commit is contained in:
Maurice Parker 2019-09-14 15:41:35 -05:00
parent 157bd57c5e
commit 16954393c0
1 changed files with 33 additions and 34 deletions

View File

@ -75,9 +75,12 @@ struct SettingsReaderAPIAccountView : View {
self.busy = false self.busy = false
switch result { switch result {
case .success(let authenticated): case .success(let validatedCredentials):
if (authenticated != nil) { guard let validatedCredentials = validatedCredentials else {
self.error = "Invalid email/password combination."
return
}
var newAccount = false var newAccount = false
let workAccount: Account let workAccount: Account
@ -96,7 +99,7 @@ struct SettingsReaderAPIAccountView : View {
workAccount.endpointURL = apiURL workAccount.endpointURL = apiURL
try workAccount.storeCredentials(credentials) try workAccount.storeCredentials(validatedCredentials)
if newAccount { if newAccount {
workAccount.refreshAll() { result in } workAccount.refreshAll() { result in }
@ -108,10 +111,6 @@ struct SettingsReaderAPIAccountView : View {
self.error = "Keychain error while storing credentials." self.error = "Keychain error while storing credentials."
} }
} else {
self.error = "Invalid email/password combination."
}
case .failure: case .failure:
self.error = "Network error. Try again later." self.error = "Network error. Try again later."
} }