1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Trigger certificate chooser on authentication change

If the user chooses client certificate authentication,
immediately pop up the certificate chooser.

If the user chooses password authentication, move the focus to the
password View.
This commit is contained in:
Joe Steele 2014-07-23 15:25:50 -04:00
parent 21cc3d9176
commit 231f3645f9
3 changed files with 22 additions and 2 deletions

View File

@ -323,6 +323,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
long id) { long id) {
updateViewFromAuthType(); updateViewFromAuthType();
validateFields(); validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL.equals(selection)) {
// This may again invoke validateFields()
mClientCertificateSpinner.chooseCertificate();
} else {
mPasswordView.requestFocus();
}
} }
@Override @Override

View File

@ -223,6 +223,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
long id) { long id) {
updateViewFromAuthType(); updateViewFromAuthType();
validateFields(); validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL.equals(selection)) {
// This may again invoke validateFields()
mClientCertificateSpinner.chooseCertificate();
} else {
mPasswordView.requestFocus();
}
} }
@Override @Override

View File

@ -51,7 +51,7 @@ public class ClientCertificateSpinner extends LinearLayout {
mSelection.setOnClickListener(new OnClickListener() { mSelection.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
onSelect(); chooseCertificate();
} }
}); });
@ -96,7 +96,7 @@ public class ClientCertificateSpinner extends LinearLayout {
setAlias(null); setAlias(null);
} }
private void onSelect() { public void chooseCertificate() {
// NOTE: keyTypes, issuers, hosts, port are not known before we actually // NOTE: keyTypes, issuers, hosts, port are not known before we actually
// open a connection, thus we cannot set them here! // open a connection, thus we cannot set them here!
KeyChain.choosePrivateKeyAlias(mActivity, new KeyChainAliasCallback() { KeyChain.choosePrivateKeyAlias(mActivity, new KeyChainAliasCallback() {