Commit c3755358 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Improve Password Checkup String in Password Check

This change improves the shown string to Password Check users that run
out of quota and are redirected to the Password Checkup in their Google
Account.

Translation Screenshot:
https://storage.cloud.google.com/chromium-translation-screenshots/5276cc79879bda188d7e8de493be26e482e77ac8

Fixed: 1062264
Change-Id: Ifd89029b2968e544eb679500b696738efad3f79d
Bug: 1062264
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128078
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755320}
parent 9b05ec76
......@@ -350,6 +350,9 @@
<message name="IDS_SETTINGS_CHECK_PASSWORDS_ERROR_TOO_MANY_PASSWORDS" desc="Error message when the password check can't be completed since the user saved too many passwords.">
Chrome can't check your passwords because there are too many.
</message>
<message name="IDS_SETTINGS_CHECK_PASSWORDS_ERROR_QUOTA_LIMIT_GOOGLE_ACCOUNT" desc="Error message when the password check can't be completed since the user hit the quota limit, but the user is able to check their passwords in their Google account.">
Chrome can't check your passwords. Try again tomorrow or <ph name="BEGIN_LINK">&lt;a href="$1" target="_blank"&gt;</ph>check passwords in your Google Account<ph name="END_LINK">&lt;/a&gt;</ph>.
</message>
<message name="IDS_SETTINGS_CHECK_PASSWORDS_ERROR_QUOTA_LIMIT" desc="Error message when the password check can't be completed since the user hit the quota limit.">
Chrome can't check your passwords. Try again tomorrow.
</message>
......@@ -368,9 +371,6 @@
<message name="IDS_SETTINGS_CHECK_PASSWORDS_AGAIN_AFTER_ERROR" desc="Button to start bulk password check manually in passwords check section after it already failed once.">
Try again
</message>
<message name="IDS_SETTINGS_CHECK_PASSWORDS_AGAIN_IN_ACCOUNT" desc="Link suggesting to perform a bulk leak check in the Google Account page.">
Check in Google Account.
</message>
<message name="IDS_SETTINGS_CHECK_PASSWORDS_PROGRESS" desc="Text for a label showing how many passwords were checked so far and how many passwords need to be checked in total.">
Checking passwords (<ph name="CHECKED_PASSWORDS">$1<ex>6</ex></ph> of <ph name="TOTAL_PASSWORDS">$2<ex>31</ex></ph>)…
</message>
......
5fd2c1fe645c994d11e0df148b735532296784de
\ No newline at end of file
......@@ -91,22 +91,15 @@
</template>
<div class="start settings-box-text">
<div id="title">
[[getTitle_(status_, suppressCheckupLink_)]]
<a class="secondary inline" id="linkToGoogleAccount"
href="[[passwordCheckUrl_]]"
target="_blank"
hidden$="[[suppressCheckupLink_]]">
$i18n{checkPasswordsAgainInAccount}
</a>
<div id="titleRow">
<span id="title" inner-h-t-m-l="[[title_]]"></span>
<span class="secondary inline" id="lastCompletedCheck"
hidden$="[[!showsTimestamp_(status_)]]">
&bull; [[status_.elapsedTimeSinceLastCheck]]
</span>
</div>
<div class="secondary" id="subtitle"
hidden$="[[!showsPasswordsCount_(status_, leakedPasswords,
suppressCheckupLink_)]]">
hidden$="[[!showsPasswordsCount_(status_, leakedPasswords)]]">
[[compromisedPasswordsCount_]]
</div>
</div>
......
......@@ -16,17 +16,6 @@ Polymer({
],
properties: {
/**
* This URL redirects to the passwords check for sync users.
* @type {!string}
* @private
*/
passwordCheckUrl_: {
type: String,
value:
'https://passwords.google.com/checkup/start?utm_source=chrome&utm_medium=desktop&utm_campaign=leak_dialog&hideExplanation=true',
},
/**
* The number of compromised passwords as a formatted string.
* @private
......@@ -63,9 +52,9 @@ Polymer({
},
/** @private */
suppressCheckupLink_: {
type: Boolean,
computed: 'suppressesCheckupLink_(status_, syncPrefs_, syncStatus_)',
title_: {
type: String,
computed: 'computeTitle_(status_, canUsePasswordCheckup_)',
},
/** @private */
......@@ -74,6 +63,11 @@ Polymer({
computed: 'computeIsSignedOut_(syncStatus_, storedAccounts_)',
},
canUsePasswordCheckup_: {
type: Boolean,
computed: 'computeCanUsePasswordCheckup_(syncPrefs_, syncStatus_)',
},
/** @private */
isButtonHidden_: {
type: Boolean,
......@@ -101,8 +95,8 @@ Polymer({
/** @private */
showNoCompromisedPasswordsLabel_: {
type: Boolean,
computed:
'computeShowNoCompromisedPasswordsLabel(syncStatus_, prefs.*, status_, leakedPasswords)',
computed: 'computeShowNoCompromisedPasswordsLabel(' +
'syncStatus_, prefs.*, status_, leakedPasswords)',
},
/** @private */
......@@ -344,7 +338,7 @@ Polymer({
* @return {string}
* @private
*/
getTitle_() {
computeTitle_() {
switch (this.status_.state) {
case CheckState.IDLE:
return this.waitsForFirstCheck_() ?
......@@ -367,7 +361,12 @@ Polymer({
case CheckState.NO_PASSWORDS:
return this.i18n('checkPasswordsErrorNoPasswords');
case CheckState.QUOTA_LIMIT:
return this.i18n('checkPasswordsErrorQuota');
// Note: For the checkup case we embed the link as HTML, thus we need to
// use i18nAdvanced() here as well as the `inner-h-t-m-l` attribute in
// the DOM.
return this.canUsePasswordCheckup_ ?
this.i18nAdvanced('checkPasswordsErrorQuotaGoogleAccount') :
this.i18n('checkPasswordsErrorQuota');
case CheckState.OTHER_ERROR:
return this.i18n('checkPasswordsErrorGeneric');
}
......@@ -554,20 +553,13 @@ Polymer({
},
/**
* Returns true iff the user cannot retry the password check in their account.
* Either because they are syncing or because they use a custom passphrase.
* Returns whether the user can use the online Password Checkup.
* @return {boolean}
* @private
*/
suppressesCheckupLink_() {
if (this.status_.state != CheckState.QUOTA_LIMIT) {
return true; // Never show the retry link for other states.
}
if (!this.syncStatus_ || !this.syncStatus_.signedIn) {
return true; // Never show the retry link for signed-out users.
}
// Show the retry link only, if user data is unencrypted.
return !!this.syncPrefs_ && !!this.syncPrefs_.encryptAllData;
computeCanUsePasswordCheckup_() {
return !!this.syncStatus_ && !!this.syncStatus_.signedIn &&
(!this.syncPrefs_ || !this.syncPrefs_.encryptAllData);
},
/**
......
......@@ -52,6 +52,7 @@
#include "components/dom_distiller/core/dom_distiller_features.h"
#include "components/google/core/common/google_util.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#include "components/password_manager/core/browser/manage_passwords_referrer.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
......@@ -748,8 +749,6 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
{"checkPasswordsAgainAfterError",
IDS_SETTINGS_CHECK_PASSWORDS_AGAIN_AFTER_ERROR},
{"checkPasswordsProgress", IDS_SETTINGS_CHECK_PASSWORDS_PROGRESS},
{"checkPasswordsAgainInAccount",
IDS_SETTINGS_CHECK_PASSWORDS_AGAIN_IN_ACCOUNT},
{"checkPasswordsStop", IDS_SETTINGS_CHECK_PASSWORDS_STOP},
{"compromisedPasswords", IDS_SETTINGS_COMPROMISED_PASSWORDS},
{"compromisedPasswordsDescription",
......@@ -880,6 +879,14 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
l10n_util::GetStringFUTF16(
IDS_SETTINGS_PASSWORDS_MANAGE_PASSWORDS,
base::UTF8ToUTF16(google_password_manager_url.spec())));
html_source->AddString(
"checkPasswordsErrorQuotaGoogleAccount",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_CHECK_PASSWORDS_ERROR_QUOTA_LIMIT_GOOGLE_ACCOUNT,
base::UTF8ToUTF16(
password_manager::GetPasswordCheckupURL(
password_manager::PasswordCheckupReferrer::kPasswordCheck)
.spec())));
html_source->AddString("googlePasswordManagerUrl",
google_password_manager_url.spec());
html_source->AddString("passwordCheckLearnMoreURL",
......
......@@ -210,7 +210,9 @@ cr.define('settings_passwords_check', function() {
sync_test_util.simulateSyncStatus({signedIn: true});
await passwordManager.whenCalled('getPasswordCheckStatus');
expectTrue(isElementVisible(section.$.linkToGoogleAccount));
expectEquals(
section.i18n('checkPasswordsErrorQuotaGoogleAccount'),
section.$.title.innerText);
expectFalse(isElementVisible(section.$.controlPasswordCheckButton));
});
......@@ -228,7 +230,8 @@ cr.define('settings_passwords_check', function() {
await passwordManager.whenCalled('getPasswordCheckStatus');
Polymer.dom.flush();
expectFalse(isElementVisible(section.$.linkToGoogleAccount));
expectEquals(
section.i18n('checkPasswordsErrorQuota'), section.$.title.innerText);
expectFalse(isElementVisible(section.$.controlPasswordCheckButton));
});
......@@ -247,7 +250,8 @@ cr.define('settings_passwords_check', function() {
await passwordManager.whenCalled('getPasswordCheckStatus');
Polymer.dom.flush();
expectFalse(isElementVisible(section.$.linkToGoogleAccount));
expectEquals(
section.i18n('checkPasswordsErrorQuota'), section.$.title.innerText);
assertFalse(isElementVisible(section.$.controlPasswordCheckButton));
});
......@@ -699,12 +703,12 @@ cr.define('settings_passwords_check', function() {
const section = createCheckPasswordSection();
await passwordManager.whenCalled('getPasswordCheckStatus');
Polymer.dom.flush();
const title = section.$.title;
const titleRow = section.$.titleRow;
const subtitle = section.$.subtitle;
assertTrue(isElementVisible(title));
assertTrue(isElementVisible(titleRow));
assertTrue(isElementVisible(subtitle));
expectEquals(
section.i18n('checkedPasswords') + ' • Just now', title.innerText);
section.i18n('checkedPasswords') + ' • Just now', titleRow.innerText);
});
// When offline, only show an error.
......
......@@ -11,6 +11,7 @@
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
#include "url/origin.h"
......@@ -20,19 +21,7 @@ namespace password_manager {
using metrics_util::LeakDialogType;
constexpr char kPasswordCheckupURL[] =
#if defined(OS_ANDROID)
"https://passwords.google.com/checkup/"
"start?utm_source=chrome&utm_medium=android&utm_campaign=leak_dialog&"
"hideExplanation=true";
#elif defined(OS_IOS)
"https://passwords.google.com/checkup/"
"start?utm_source=chrome&utm_medium=ios&utm_campaign=leak_dialog&"
"hideExplanation=true";
#else
"https://passwords.google.com/checkup/"
"start?utm_source=chrome&utm_medium=desktop&utm_campaign=leak_dialog&"
"hideExplanation=true";
#endif
"https://passwords.google.com/checkup/start?hideExplanation=true";
CredentialLeakType CreateLeakType(IsSaved is_saved,
IsReused is_reused,
......@@ -121,8 +110,25 @@ LeakDialogType GetLeakDialogType(CredentialLeakType leak_type) {
: LeakDialogType::kCheckupAndChange;
}
GURL GetPasswordCheckupURL() {
return GURL(kPasswordCheckupURL);
GURL GetPasswordCheckupURL(PasswordCheckupReferrer referrer) {
GURL url(kPasswordCheckupURL);
url = net::AppendQueryParameter(url, "utm_source", "chrome");
#if defined(OS_ANDROID)
const char* const medium = "android";
#elif defined(OS_IOS)
const char* const medium = "ios";
#else
const char* const medium = "desktop";
#endif
url = net::AppendQueryParameter(url, "utm_medium", medium);
const char* const campaign =
referrer == PasswordCheckupReferrer::kLeakDetectionDialog
? "leak_dialog"
: "password_settings";
return net::AppendQueryParameter(url, "utm_campaign", campaign);
}
} // namespace password_manager
......@@ -26,6 +26,13 @@ enum CredentialLeakFlags {
kSyncingPasswordsNormally = 1 << 2,
};
enum class PasswordCheckupReferrer {
// Corresponds to the leak detection dialog shown on Desktop and Mobile.
kLeakDetectionDialog = 0,
// Corresponds to Chrome's password check page on Desktop.
kPasswordCheck = 1,
};
// Contains combination of CredentialLeakFlags values.
using CredentialLeakType = std::underlying_type_t<CredentialLeakFlags>;
......@@ -75,7 +82,8 @@ password_manager::metrics_util::LeakDialogType GetLeakDialogType(
password_manager::CredentialLeakType leak_type);
// Returns the URL used to launch the password checkup.
GURL GetPasswordCheckupURL();
GURL GetPasswordCheckupURL(PasswordCheckupReferrer referrer =
PasswordCheckupReferrer::kLeakDetectionDialog);
} // namespace password_manager
......
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