Commit 1b1c7d72 authored by Danila Kuzmin's avatar Danila Kuzmin Committed by Commit Bot

Weak PIN allowed by policy warning fix

When the weak PIN is allowed, we don't need to show the warning
message to user. But when the policy is unset we still show it.

Bug: b/168498866
Change-Id: I56571851ca43144b2e05f31978814d0b9c384b64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490040Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Danila Kuzmin <dkuzmin@google.com>
Cr-Commit-Position: refs/heads/master@{#825325}
parent b84c367d
......@@ -469,6 +469,8 @@ QuickUnlockPrivateCheckCredentialFunction::Run() {
Profile* profile = GetActiveProfile(browser_context());
PrefService* pref_service = profile->GetPrefs();
bool allow_weak = pref_service->GetBoolean(prefs::kPinUnlockWeakPinsAllowed);
bool is_allow_weak_pin_pref_set =
pref_service->HasPrefPath(prefs::kPinUnlockWeakPinsAllowed);
// Check and return the problems.
std::vector<CredentialProblem>& warnings = result->warnings;
......@@ -481,7 +483,8 @@ QuickUnlockPrivateCheckCredentialFunction::Run() {
if (length_problem != CredentialProblem::CREDENTIAL_PROBLEM_NONE)
errors.push_back(length_problem);
if (!IsPinDifficultEnough(credential)) {
if ((!allow_weak || !is_allow_weak_pin_pref_set) &&
!IsPinDifficultEnough(credential)) {
auto& log = allow_weak ? warnings : errors;
log.push_back(CredentialProblem::CREDENTIAL_PROBLEM_TOO_WEAK);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment