mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Try to authenticate new account details before setting them
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
7b826d5ef2
commit
ad2a2c40d8
1 changed files with 22 additions and 5 deletions
|
@ -119,11 +119,28 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
|
||||||
)
|
)
|
||||||
ncKit.setup(delegate: changeObserver)
|
ncKit.setup(delegate: changeObserver)
|
||||||
|
|
||||||
Logger.fileProviderExtension.info(
|
Task {
|
||||||
"Nextcloud account set up in File Provider extension for user: \(user, privacy: .public) at server: \(serverUrl, privacy: .public)"
|
switch (await ncKit.tryAuthenticationAttempt()) {
|
||||||
)
|
case .authenticationError:
|
||||||
|
Logger.fileProviderExtension.info(
|
||||||
signalEnumeratorAfterAccountSetup()
|
"\(user, privacy: .public) authentication failed due to bad creds, stopping"
|
||||||
|
)
|
||||||
|
ncAccount = nil
|
||||||
|
ncKit.setup(user: "", userId: "", password: "", urlBase: "") // In case ongoing ops
|
||||||
|
case .connectionError:
|
||||||
|
Logger.fileProviderExtension.info(
|
||||||
|
"\(user, privacy: .public) authentication try failed due to internet connectivity issues."
|
||||||
|
)
|
||||||
|
case .success:
|
||||||
|
Logger.fileProviderExtension.info(
|
||||||
|
"""
|
||||||
|
Authenticated! Nextcloud account set up in File Provider extension.
|
||||||
|
User: \(user, privacy: .public) at server: \(serverUrl, privacy: .public)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Task { @MainActor in signalEnumeratorAfterAccountSetup() }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func removeAccountConfig() {
|
@objc func removeAccountConfig() {
|
||||||
|
|
Loading…
Reference in a new issue