[High5] Update pin status text for pin-only
Bug: b:357606198, b:348326316 Change-Id: I6431af938ad74bbf6c89c12e30276a5e9210a554 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872421 Reviewed-by: Denis Kuznetsov <antrim@chromium.org> Commit-Queue: Hardik Goyal <hardikgoyal@chromium.org> Cr-Commit-Position: refs/heads/main@{#1358265}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7a86fc8b14
commit
b3ecae64aa
@ -5254,6 +5254,12 @@ No devices connected.
|
||||
<message name="IDS_ASH_LOGIN_POD_PIN_LOCKED_WARNING" desc="Message shown when pin is soft locked due to multiple wrong attempts.">
|
||||
Too many PIN attempts. Wait <ph name="TIME_LEFT">$1<ex>15 minutes, 10 seconds</ex></ph> and try PIN again, or enter password to sign in immediately.
|
||||
</message>
|
||||
<message name="IDS_ASH_LOGIN_POD_PIN_LOCKED_NO_PASSWORD_WARNING" desc="Message shown when pin is soft locked due to multiple wrong attempts, and the user does not have a password configured.">
|
||||
Too many PIN attempts. Wait <ph name="TIME_LEFT">$1<ex>15 minutes, 10 seconds</ex></ph> and try again.
|
||||
</message>
|
||||
<message name="IDS_ASH_LOGIN_POD_PIN_LOCKED_RECOVERY_PROMPT" desc="Message shown to prompt user to recover the account when the pin is locked.">
|
||||
If you forgot your PIN, try recovering this user.
|
||||
</message>
|
||||
|
||||
<!-- Authentication strings -->
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
ff7276991616605cacc49a59287771ebadd9dcd6
|
@ -0,0 +1 @@
|
||||
ff7276991616605cacc49a59287771ebadd9dcd6
|
@ -798,8 +798,8 @@ void LoginAuthUserView::SetAuthMethods(
|
||||
recover_button_->SetVisible(current_state.show_recover_button);
|
||||
pin_status_message_view_->SetVisible(current_state.pin_is_locked);
|
||||
if (current_state.pin_is_locked) {
|
||||
pin_status_message_view_->SetPinAvailbleAt(
|
||||
auth_metadata.pin_available_at.value());
|
||||
pin_status_message_view_->SetPinInfo(auth_metadata.pin_available_at.value(),
|
||||
current_state.show_recover_button);
|
||||
}
|
||||
|
||||
// Adjust the PIN keyboard visibility before the password textfield's one, so
|
||||
|
@ -24,7 +24,7 @@ namespace {
|
||||
constexpr int kVerticalBorderDp = 20;
|
||||
constexpr int kHorizontalBorderDp = 0;
|
||||
constexpr int kWidthDp = 320;
|
||||
constexpr int kHeightDp = 100;
|
||||
constexpr int kHeightDp = 120;
|
||||
constexpr int kDeltaDp = 0;
|
||||
// The time interval to refresh the pin delay message.
|
||||
constexpr base::TimeDelta kRefreshInterval = base::Milliseconds(200);
|
||||
@ -82,18 +82,19 @@ PinStatusMessageView::~PinStatusMessageView() {
|
||||
message_ = nullptr;
|
||||
}
|
||||
|
||||
void PinStatusMessageView::SetPinAvailbleAt(base::Time available_at) {
|
||||
void PinStatusMessageView::SetPinInfo(base::Time available_at,
|
||||
bool is_pin_only) {
|
||||
available_at_ = available_at;
|
||||
is_pin_only_ = is_pin_only;
|
||||
UpdateUI();
|
||||
timer_.Start(FROM_HERE, kRefreshInterval, this,
|
||||
&PinStatusMessageView::UpdateUI, base::TimeTicks::Now());
|
||||
SetVisible(true);
|
||||
}
|
||||
|
||||
void PinStatusMessageView::UpdateUI() {
|
||||
base::TimeDelta time_left = available_at_ - base::Time::Now();
|
||||
if (!time_left.is_positive()) {
|
||||
on_pin_unlock_.Run();
|
||||
SetVisible(false);
|
||||
message_->SetText(std::u16string());
|
||||
timer_.Stop();
|
||||
return;
|
||||
@ -101,7 +102,15 @@ void PinStatusMessageView::UpdateUI() {
|
||||
std::u16string time_left_message;
|
||||
if (TimeDurationFormat(time_left, &time_left_message)) {
|
||||
std::u16string message_warning = l10n_util::GetStringFUTF16(
|
||||
IDS_ASH_LOGIN_POD_PIN_LOCKED_WARNING, time_left_message);
|
||||
is_pin_only_ ? IDS_ASH_LOGIN_POD_PIN_LOCKED_NO_PASSWORD_WARNING
|
||||
: IDS_ASH_LOGIN_POD_PIN_LOCKED_WARNING,
|
||||
time_left_message);
|
||||
if (is_pin_only_) {
|
||||
base::StrAppend(
|
||||
&message_warning,
|
||||
{u"\n\n", l10n_util::GetStringUTF16(
|
||||
IDS_ASH_LOGIN_POD_PIN_LOCKED_RECOVERY_PROMPT)});
|
||||
}
|
||||
message_->SetText(message_warning);
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,9 @@ class PinStatusMessageView : public views::View {
|
||||
|
||||
~PinStatusMessageView() override;
|
||||
|
||||
// Set remaining time to be shown in the message.
|
||||
void SetPinAvailbleAt(base::Time available_at);
|
||||
// Set the relevant PIN information (pin available time, if pin the only
|
||||
// auth factor) to be shown in the message.
|
||||
void SetPinInfo(base::Time available_at, bool is_pin_only);
|
||||
|
||||
// views::View:
|
||||
void RequestFocus() override;
|
||||
@ -50,6 +51,7 @@ class PinStatusMessageView : public views::View {
|
||||
raw_ptr<views::Label> message_;
|
||||
|
||||
OnPinUnlock on_pin_unlock_;
|
||||
bool is_pin_only_;
|
||||
base::Time available_at_;
|
||||
base::MetronomeTimer timer_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user