Commit 450e779d authored by Maciek Slusarczyk's avatar Maciek Slusarczyk Committed by Commit Bot

Do not show error after re-starting password sync.

When the online sign-in flow is executed after password change CrOS
shows old password confirmation dialog. If the old password provided by
the user is incorrect the dialog is displayed with an error message. The
message stays there even if we cancel the flow and start from scratch.
This CL introduced a new flag that checks if the flow was restarted anew
and if so hides the error message.

Bug: 1138083
Change-Id: I8a6c6cafcbedf154f8d0cc008ed0510ed6373e0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537639
Commit-Queue: Maciek Slusarczyk <mslus@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#830993}
parent 0779a9ea
...@@ -24,10 +24,12 @@ void RecordEulaScreenAction(GaiaPasswordChangedScreen::UserAction value) { ...@@ -24,10 +24,12 @@ void RecordEulaScreenAction(GaiaPasswordChangedScreen::UserAction value) {
} }
GaiaPasswordChangedScreen::GaiaPasswordChangedScreen( GaiaPasswordChangedScreen::GaiaPasswordChangedScreen(
const ScreenExitCallback& exit_callback,
GaiaPasswordChangedView* view) GaiaPasswordChangedView* view)
: BaseScreen(GaiaPasswordChangedView::kScreenId, : BaseScreen(GaiaPasswordChangedView::kScreenId,
OobeScreenPriority::DEFAULT), OobeScreenPriority::DEFAULT),
view_(view) { exit_callback_(exit_callback) {
view_ = view;
if (view_) if (view_)
view_->Bind(this); view_->Bind(this);
} }
...@@ -64,14 +66,13 @@ void GaiaPasswordChangedScreen::Configure(const AccountId& account_id, ...@@ -64,14 +66,13 @@ void GaiaPasswordChangedScreen::Configure(const AccountId& account_id,
void GaiaPasswordChangedScreen::OnUserAction(const std::string& action_id) { void GaiaPasswordChangedScreen::OnUserAction(const std::string& action_id) {
if (action_id == kUserActionCancelLogin) { if (action_id == kUserActionCancelLogin) {
CancelPasswordChangedFlow();
RecordEulaScreenAction(UserAction::kCancel); RecordEulaScreenAction(UserAction::kCancel);
CancelPasswordChangedFlow();
} else if (action_id == kUserActionResyncData) { } else if (action_id == kUserActionResyncData) {
RecordEulaScreenAction(UserAction::kResyncUserData); RecordEulaScreenAction(UserAction::kResyncUserData);
// LDH will pass control to ExistingUserController to proceed with clearing // LDH will pass control to ExistingUserController to proceed with clearing
// cryptohome. // cryptohome.
if (LoginDisplayHost::default_host()) exit_callback_.Run(Result::RESYNC);
LoginDisplayHost::default_host()->ResyncUserData();
} }
} }
...@@ -95,7 +96,7 @@ void GaiaPasswordChangedScreen::CancelPasswordChangedFlow() { ...@@ -95,7 +96,7 @@ void GaiaPasswordChangedScreen::CancelPasswordChangedFlow() {
} }
void GaiaPasswordChangedScreen::OnCookiesCleared() { void GaiaPasswordChangedScreen::OnCookiesCleared() {
LoginDisplayHost::default_host()->StartSignInScreen(); exit_callback_.Run(Result::CANCEL);
} }
} // namespace chromeos } // namespace chromeos
...@@ -20,7 +20,16 @@ class GaiaPasswordChangedScreen : public BaseScreen { ...@@ -20,7 +20,16 @@ class GaiaPasswordChangedScreen : public BaseScreen {
public: public:
using TView = GaiaPasswordChangedView; using TView = GaiaPasswordChangedView;
explicit GaiaPasswordChangedScreen(GaiaPasswordChangedView* view); enum class Result {
CANCEL,
RESYNC,
MIGRATE,
};
using ScreenExitCallback = base::RepeatingCallback<void(Result result)>;
explicit GaiaPasswordChangedScreen(const ScreenExitCallback& exit_callback,
GaiaPasswordChangedView* view);
GaiaPasswordChangedScreen(const GaiaPasswordChangedScreen&) = delete; GaiaPasswordChangedScreen(const GaiaPasswordChangedScreen&) = delete;
GaiaPasswordChangedScreen& operator=(const GaiaPasswordChangedScreen&) = GaiaPasswordChangedScreen& operator=(const GaiaPasswordChangedScreen&) =
delete; delete;
...@@ -59,6 +68,7 @@ class GaiaPasswordChangedScreen : public BaseScreen { ...@@ -59,6 +68,7 @@ class GaiaPasswordChangedScreen : public BaseScreen {
bool show_error_ = false; bool show_error_ = false;
GaiaPasswordChangedView* view_ = nullptr; GaiaPasswordChangedView* view_ = nullptr;
ScreenExitCallback exit_callback_;
base::WeakPtrFactory<GaiaPasswordChangedScreen> weak_factory_{this}; base::WeakPtrFactory<GaiaPasswordChangedScreen> weak_factory_{this};
}; };
......
...@@ -348,7 +348,9 @@ void LoginDisplayHostCommon::Observe( ...@@ -348,7 +348,9 @@ void LoginDisplayHostCommon::Observe(
ShutdownDisplayHost(); ShutdownDisplayHost();
} }
void LoginDisplayHostCommon::OnCancelPasswordChangedFlow() {} void LoginDisplayHostCommon::OnCancelPasswordChangedFlow() {
LoginDisplayHost::default_host()->StartSignInScreen();
}
void LoginDisplayHostCommon::OnAuthPrewarmDone() { void LoginDisplayHostCommon::OnAuthPrewarmDone() {
auth_prewarmer_.reset(); auth_prewarmer_.reset();
......
...@@ -649,8 +649,12 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() { ...@@ -649,8 +649,12 @@ std::vector<std::unique_ptr<BaseScreen>> WizardController::CreateScreens() {
append(std::make_unique<TpmErrorScreen>( append(std::make_unique<TpmErrorScreen>(
oobe_ui->GetView<TpmErrorScreenHandler>())); oobe_ui->GetView<TpmErrorScreenHandler>()));
append(std::make_unique<GaiaPasswordChangedScreen>( auto gaia_password_change_screen =
oobe_ui->GetView<GaiaPasswordChangedScreenHandler>())); std::make_unique<GaiaPasswordChangedScreen>(
base::BindRepeating(&WizardController::OnPasswordChangeScreenExit,
weak_factory_.GetWeakPtr()),
oobe_ui->GetView<GaiaPasswordChangedScreenHandler>());
append(std::move(gaia_password_change_screen));
append(std::make_unique<ActiveDirectoryPasswordChangeScreen>( append(std::make_unique<ActiveDirectoryPasswordChangeScreen>(
oobe_ui->GetView<ActiveDirectoryPasswordChangeScreenHandler>(), oobe_ui->GetView<ActiveDirectoryPasswordChangeScreenHandler>(),
...@@ -941,6 +945,22 @@ void WizardController::OnGaiaScreenExit(GaiaScreen::Result result) { ...@@ -941,6 +945,22 @@ void WizardController::OnGaiaScreenExit(GaiaScreen::Result result) {
} }
} }
void WizardController::OnPasswordChangeScreenExit(
GaiaPasswordChangedScreen::Result result) {
if (!LoginDisplayHost::default_host())
return;
switch (result) {
case GaiaPasswordChangedScreen::Result::CANCEL:
LoginDisplayHost::default_host()->CancelPasswordChangedFlow();
break;
case GaiaPasswordChangedScreen::Result::RESYNC:
LoginDisplayHost::default_host()->ResyncUserData();
break;
case GaiaPasswordChangedScreen::Result::MIGRATE:
NOTREACHED();
}
}
void WizardController::OnActiveDirectoryLoginScreenExit() { void WizardController::OnActiveDirectoryLoginScreenExit() {
OnScreenExit(ActiveDirectoryLoginView::kScreenId, kDefaultExitReason); OnScreenExit(ActiveDirectoryLoginView::kScreenId, kDefaultExitReason);
LoginDisplayHost::default_host()->HideOobeDialog(); LoginDisplayHost::default_host()->HideOobeDialog();
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "chrome/browser/chromeos/login/screens/eula_screen.h" #include "chrome/browser/chromeos/login/screens/eula_screen.h"
#include "chrome/browser/chromeos/login/screens/family_link_notice_screen.h" #include "chrome/browser/chromeos/login/screens/family_link_notice_screen.h"
#include "chrome/browser/chromeos/login/screens/fingerprint_setup_screen.h" #include "chrome/browser/chromeos/login/screens/fingerprint_setup_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_password_changed_screen.h"
#include "chrome/browser/chromeos/login/screens/gaia_screen.h" #include "chrome/browser/chromeos/login/screens/gaia_screen.h"
#include "chrome/browser/chromeos/login/screens/gesture_navigation_screen.h" #include "chrome/browser/chromeos/login/screens/gesture_navigation_screen.h"
#include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
...@@ -320,6 +321,7 @@ class WizardController { ...@@ -320,6 +321,7 @@ class WizardController {
void OnFamilyLinkNoticeScreenExit(FamilyLinkNoticeScreen::Result result); void OnFamilyLinkNoticeScreenExit(FamilyLinkNoticeScreen::Result result);
void OnUserCreationScreenExit(UserCreationScreen::Result result); void OnUserCreationScreenExit(UserCreationScreen::Result result);
void OnGaiaScreenExit(GaiaScreen::Result result); void OnGaiaScreenExit(GaiaScreen::Result result);
void OnPasswordChangeScreenExit(GaiaPasswordChangedScreen::Result result);
void OnActiveDirectoryLoginScreenExit(); void OnActiveDirectoryLoginScreenExit();
void OnSignInFatalErrorScreenExit(); void OnSignInFatalErrorScreenExit();
void OnEduCoexistenceLoginScreenExit( void OnEduCoexistenceLoginScreenExit(
......
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