Merge pull request #5591 from k9mail/fix_missing_password_check
Fix check for missing incoming/outgoing server credentials
This commit is contained in:
commit
65870fbab2
3 changed files with 9 additions and 4 deletions
|
@ -392,7 +392,7 @@ public class MessagingController {
|
|||
public void refreshFolderListSynchronous(Account account) {
|
||||
try {
|
||||
ServerSettings serverSettings = account.getIncomingServerSettings();
|
||||
if (serverSettings.password == null) {
|
||||
if (serverSettings.isMissingCredentials()) {
|
||||
handleAuthenticationFailure(account, true);
|
||||
return;
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ public class MessagingController {
|
|||
|
||||
private void syncFolder(Account account, long folderId, MessagingListener listener, Backend backend) {
|
||||
ServerSettings serverSettings = account.getIncomingServerSettings();
|
||||
if (serverSettings.password == null) {
|
||||
if (serverSettings.isMissingCredentials()) {
|
||||
handleAuthenticationFailure(account, true);
|
||||
return;
|
||||
}
|
||||
|
@ -1512,7 +1512,7 @@ public class MessagingController {
|
|||
boolean wasPermanentFailure = false;
|
||||
try {
|
||||
ServerSettings serverSettings = account.getOutgoingServerSettings();
|
||||
if (serverSettings.password == null) {
|
||||
if (serverSettings.isMissingCredentials()) {
|
||||
handleAuthenticationFailure(account, false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class MailSyncWorker(
|
|||
return Result.success()
|
||||
}
|
||||
|
||||
if (account.incomingServerSettings.password == null) {
|
||||
if (account.incomingServerSettings.isMissingCredentials) {
|
||||
Timber.d("Password for this account is missing. Skipping mail sync.")
|
||||
return Result.success()
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ data class ServerSettings @JvmOverloads constructor(
|
|||
@JvmField val clientCertificateAlias: String?,
|
||||
val extra: Map<String, String?> = emptyMap()
|
||||
) {
|
||||
val isMissingCredentials: Boolean = when (authenticationType) {
|
||||
AuthType.EXTERNAL -> clientCertificateAlias == null
|
||||
else -> password == null
|
||||
}
|
||||
|
||||
init {
|
||||
require(type == type.toLowerCase(Locale.ROOT)) { "type must be all lower case" }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue