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

[Passwords] Show toast when screen lock is missing

This change implements showing a toast when to screen lock is set up and
the user wants to edit a compromised password within the Password Check.

Translation Screenshot:
https://storage.cloud.google.com/chromium-translation-screenshots/2d5e2a564fc468f0e58bf4ae9d500d14c5b369e1

Bug: 1114720
Change-Id: Ibdcf22391543916e41b21c7a80a2657b7d64629d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360272
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799018}
parent 8e28fe49
......@@ -142,7 +142,7 @@ class PasswordCheckMediator
@Override
public void onEdit(CompromisedCredential credential) {
if (!mReauthenticationHelper.canReauthenticate()) {
// TODO(crbug.com/1114720): Implement Toast explaining to set-up screen lock.
mReauthenticationHelper.showScreenLockToast();
return;
}
......
......@@ -14,6 +14,7 @@ import org.chromium.base.Callback;
import org.chromium.chrome.browser.password_check.internal.R;
import org.chromium.chrome.browser.password_manager.settings.ReauthenticationManager;
import org.chromium.chrome.browser.password_manager.settings.ReauthenticationManager.ReauthScope;
import org.chromium.ui.widget.Toast;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
......@@ -77,6 +78,15 @@ public class PasswordCheckReauthenticationHelper {
descriptionId, View.NO_ID, mFragmentManager, ReauthScope.ONE_AT_A_TIME);
}
/**
* Shows a toast to the user nudging them to set up a screen lock. Intended to be called in case
* {@link #canReauthenticate()} returns false.
*/
public void showScreenLockToast() {
Toast.makeText(mContext, R.string.password_check_set_screen_lock_text, Toast.LENGTH_LONG)
.show();
}
/**
* Invoked when a reauthentication might have happened. Invokes {@link Callback#onResult}
* with whether the user passed the reauthentication challenge.
......
......@@ -254,6 +254,11 @@
Edit password
</message>
<!-- Password Check Toast strings -->
<message name="IDS_PASSWORD_CHECK_SET_SCREEN_LOCK_TEXT" desc="Text prompting user to set a screen lock in order to view or edit their compromised passwords.">
To view or edit your password here, set screen lock on this device.
</message>
<!-- Lock Screen Fragment strings -->
<message name="IDS_PASSWORD_CHECK_LOCKSCREEN_DESCRIPTION_VIEW" desc="When a user attempts to view a compromised password for a particular website, Chrome launches a lock screen to verify the user's identity and displays the following explanation.">
Unlock to view password
......
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