Merge "ChooseLockPassword: convert to use PasswordMetrics#validateCredential()"
This commit is contained in:
@@ -705,18 +705,17 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
|
||||
/**
|
||||
* Validates PIN/Password and returns the validation result and updates mValidationErrors
|
||||
* and mPasswordReused to reflect validation results.
|
||||
* to reflect validation results.
|
||||
*
|
||||
* @param credential credential the user typed in.
|
||||
* @return whether password satisfies all the requirements.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean validatePassword(LockscreenCredential credential) {
|
||||
final byte[] password = credential.getCredential();
|
||||
mValidationErrors = PasswordMetrics.validatePassword(
|
||||
mMinMetrics, mMinComplexity, !mIsAlphaMode, password);
|
||||
if (mValidationErrors.isEmpty() && mLockPatternUtils.checkPasswordHistory(
|
||||
password, getPasswordHistoryHashFactor(), mUserId)) {
|
||||
mValidationErrors = PasswordMetrics.validateCredential(mMinMetrics, mMinComplexity,
|
||||
credential);
|
||||
if (mValidationErrors.isEmpty() && mLockPatternUtils.checkPasswordHistory(
|
||||
credential.getCredential(), getPasswordHistoryHashFactor(), mUserId)) {
|
||||
mValidationErrors =
|
||||
Collections.singletonList(new PasswordValidationError(RECENTLY_USED));
|
||||
}
|
||||
@@ -893,8 +892,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
final boolean canInput = mSaveAndFinishWorker == null;
|
||||
|
||||
LockscreenCredential password = mIsAlphaMode
|
||||
? LockscreenCredential.createPasswordOrNone(mPasswordEntry.getText())
|
||||
: LockscreenCredential.createPinOrNone(mPasswordEntry.getText());
|
||||
? LockscreenCredential.createPassword(mPasswordEntry.getText())
|
||||
: LockscreenCredential.createPin(mPasswordEntry.getText());
|
||||
final int length = password.size();
|
||||
if (mUiStage == Stage.Introduction) {
|
||||
mPasswordRestrictionView.setVisibility(View.VISIBLE);
|
||||
|
Reference in New Issue
Block a user