Add password error hint when adding new cert.
This commit is contained in:
@@ -1990,12 +1990,12 @@ found in the list of installed applications.</string>
|
||||
<string name="cstor_password_verification_error">Please enter the password again. The password must have at least 8 characters and must not contain spaces.</string>
|
||||
<string name="cstor_name_empty_error">Please enter a name.</string>
|
||||
<string name="cstor_name_char_error">Please enter a name that contains only letters and numbers.</string>
|
||||
<string name="cstor_storage_error">Unable to save the certificate. Click OK to retry.</string>
|
||||
|
||||
<!-- toast message -->
|
||||
<string name="cstor_is_enabled">Credential storage is enabled.</string>
|
||||
<!-- toast message -->
|
||||
<string name="cstor_is_added">%s is added.</string>
|
||||
<string name="cstor_add_error">Failed to add %s.</string>
|
||||
|
||||
<!-- Sound settings screen, setting check box label -->
|
||||
<string name="emergency_tone_title">Emergency tone</string>
|
||||
|
@@ -516,16 +516,6 @@ public class SecuritySettings extends PreferenceActivity implements
|
||||
mAccessCheckBox.setChecked(false);
|
||||
}
|
||||
|
||||
private void addCredential() {
|
||||
String formatString = mCstorAddCredentialHelper.saveToStorage() < 0
|
||||
? getString(R.string.cstor_add_error)
|
||||
: getString(R.string.cstor_is_added);
|
||||
String message = String.format(formatString,
|
||||
mCstorAddCredentialHelper.getName());
|
||||
Toast.makeText(SecuritySettings.this, message, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
if (mCstorAddCredentialHelper != null) {
|
||||
// release the object here so that it doesn't get triggerred in
|
||||
@@ -578,7 +568,12 @@ public class SecuritySettings extends PreferenceActivity implements
|
||||
} else if (!isCstorUnlocked()) {
|
||||
showDialog(CSTOR_UNLOCK_DIALOG);
|
||||
} else {
|
||||
addCredential();
|
||||
String formatString =
|
||||
getString(R.string.cstor_is_added);
|
||||
String message = String.format(formatString,
|
||||
mCstorAddCredentialHelper.getName());
|
||||
Toast.makeText(SecuritySettings.this, message,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
} else if (mSpecialIntent != null) {
|
||||
@@ -630,6 +625,15 @@ public class SecuritySettings extends PreferenceActivity implements
|
||||
mCstorAddCredentialHelper.setPassword(password);
|
||||
}
|
||||
|
||||
if (mCstorAddCredentialHelper.saveToStorage() < 0) {
|
||||
if (mCstorAddCredentialHelper.isPkcs12Keystore()) {
|
||||
showError(R.string.cstor_password_error);
|
||||
} else {
|
||||
showError(R.string.cstor_storage_error);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user