mirror of
https://github.com/moparisthebest/k-9
synced 2025-03-03 01:51:49 -05:00
Eliminate the LOGIN authentication option from SMTP
The LOGIN option is no longer offered to users as a choice. This does *not* eliminate the SASL LOGIN authentication mechanism. Any pre-existing LOGIN setting or any imported LOGIN setting will still be recognized. In all cases, a user setting of either "Normal password" or "LOGIN" will result in the SASL PLAIN mechanism being tried first if available, otherwise SASL LOGIN will be tried if available. This mirrors similar behavior that exists for IMAP.
This commit is contained in:
parent
dc9720ca13
commit
90fedf7125
@ -56,6 +56,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
private ViewGroup mRequireLoginSettingsView;
|
private ViewGroup mRequireLoginSettingsView;
|
||||||
private Spinner mSecurityTypeView;
|
private Spinner mSecurityTypeView;
|
||||||
private Spinner mAuthTypeView;
|
private Spinner mAuthTypeView;
|
||||||
|
private ArrayAdapter<AuthType> mAuthTypeAdapter;
|
||||||
private Button mNextButton;
|
private Button mNextButton;
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
private boolean mMakeDefault;
|
private boolean mMakeDefault;
|
||||||
@ -125,10 +126,11 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||||
|
|
||||||
ArrayAdapter<AuthType> authTypesAdapter = new ArrayAdapter<AuthType>(this,
|
AuthType[] acceptableAuthTypes = {AuthType.AUTOMATIC, AuthType.PLAIN, AuthType.CRAM_MD5};
|
||||||
android.R.layout.simple_spinner_item, AuthType.values());
|
mAuthTypeAdapter = new ArrayAdapter<AuthType>(this,
|
||||||
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
android.R.layout.simple_spinner_item, acceptableAuthTypes);
|
||||||
mAuthTypeView.setAdapter(authTypesAdapter);
|
mAuthTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
mAuthTypeView.setAdapter(mAuthTypeAdapter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calls validateFields() which enables or disables the Next button
|
* Calls validateFields() which enables or disables the Next button
|
||||||
@ -196,7 +198,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (authType != null) {
|
if (authType != null) {
|
||||||
int position = AuthType.valueOf(authType).ordinal();
|
int position = mAuthTypeAdapter.getPosition(AuthType.valueOf(authType));
|
||||||
mAuthTypeView.setSelection(position, false);
|
mAuthTypeView.setSelection(position, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,12 +305,11 @@ public class SmtpTransport extends Transport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useAuthLogin = AuthType.LOGIN.equals(mAuthType);
|
boolean useAuthPlain = AuthType.PLAIN.equals(mAuthType) || AuthType.LOGIN.equals(mAuthType);
|
||||||
boolean useAuthPlain = AuthType.PLAIN.equals(mAuthType);
|
|
||||||
boolean useAuthCramMD5 = AuthType.CRAM_MD5.equals(mAuthType);
|
boolean useAuthCramMD5 = AuthType.CRAM_MD5.equals(mAuthType);
|
||||||
|
|
||||||
// Automatically choose best authentication method if none was explicitly selected
|
// Automatically choose best authentication method if none was explicitly selected
|
||||||
boolean useAutomaticAuth = !(useAuthLogin || useAuthPlain || useAuthCramMD5);
|
boolean useAutomaticAuth = !(useAuthPlain || useAuthCramMD5);
|
||||||
|
|
||||||
boolean authLoginSupported = false;
|
boolean authLoginSupported = false;
|
||||||
boolean authPlainSupported = false;
|
boolean authPlainSupported = false;
|
||||||
@ -360,11 +359,7 @@ public class SmtpTransport extends Transport {
|
|||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (useAuthLogin || (useAutomaticAuth && authLoginSupported)) {
|
} else if (useAutomaticAuth && authLoginSupported) {
|
||||||
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
|
||||||
Log.d(K9.LOG_TAG, "Using LOGIN as authentication method although the " +
|
|
||||||
"server didn't advertise support for it in EHLO response.");
|
|
||||||
}
|
|
||||||
saslAuthLogin(mUsername, mPassword);
|
saslAuthLogin(mUsername, mPassword);
|
||||||
} else {
|
} else {
|
||||||
throw new MessagingException("No valid authentication mechanism found.");
|
throw new MessagingException("No valid authentication mechanism found.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user