diff options
author | dzhioev <dzhioev@chromium.org> | 2016-03-22 11:46:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 18:48:15 +0000 |
commit | 6cc34bcffc390095882ad2f490f71bf5de5ffeb1 (patch) | |
tree | 59395a685d0a1586c9808f453be90b8711897c52 | |
parent | 029c2f4532cae3def6455b83942820fe9e9c0622 (diff) | |
download | chromium_src-6cc34bcffc390095882ad2f490f71bf5de5ffeb1.zip chromium_src-6cc34bcffc390095882ad2f490f71bf5de5ffeb1.tar.gz chromium_src-6cc34bcffc390095882ad2f490f71bf5de5ffeb1.tar.bz2 |
Block user removal when login attempt is in progress.
BUG=596499
Review URL: https://codereview.chromium.org/1823013002
Cr-Commit-Position: refs/heads/master@{#382622}
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.cc | 49 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc | 5 |
2 files changed, 29 insertions, 25 deletions
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 2173069..d207e5b 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -334,12 +334,16 @@ void ExistingUserController::CancelPasswordChangedFlow() { } void ExistingUserController::CompleteLogin(const UserContext& user_context) { - login_display_->set_signin_completed(true); if (!host_) { // Complete login event was generated already from UI. Ignore notification. return; } + if (is_login_in_progress_) + return; + + is_login_in_progress_ = true; + ContinueLoginIfDeviceNotDisabled(base::Bind( &ExistingUserController::DoCompleteLogin, weak_factory_.GetWeakPtr(), @@ -356,6 +360,24 @@ bool ExistingUserController::IsSigninInProgress() const { void ExistingUserController::Login(const UserContext& user_context, const SigninSpecifics& specifics) { + if (is_login_in_progress_) { + // If there is another login in progress, bail out. Do not re-enable + // clicking on other windows and the status area. Do not start the + // auto-login timer. + return; + } + + is_login_in_progress_ = true; + + if (user_context.GetUserType() != user_manager::USER_TYPE_REGULAR && + user_manager::UserManager::Get()->IsUserLoggedIn()) { + // Multi-login is only allowed for regular users. If we are attempting to + // do multi-login as another type of user somehow, bail out. Do not + // re-enable clicking on other windows and the status area. Do not start the + // auto-login timer. + return; + } + ContinueLoginIfDeviceNotDisabled(base::Bind( &ExistingUserController::DoLogin, weak_factory_.GetWeakPtr(), @@ -1039,14 +1061,7 @@ void ExistingUserController::PerformPreLoginActions( last_login_attempt_account_id_ = user_context.GetAccountId(); num_login_attempts_ = 0; } - - // Guard in cases when we're called twice but login process is still active. - // This might happen when login process is paused till signed settings status - // is verified which results in Login* method called again as a callback. - if (!is_login_in_progress_) - num_login_attempts_++; - - is_login_in_progress_ = true; + num_login_attempts_++; // Stop the auto-login timer when attempting login. StopPublicSessionAutoLoginTimer(); @@ -1166,22 +1181,6 @@ void ExistingUserController::DoCompleteLogin( void ExistingUserController::DoLogin(const UserContext& user_context, const SigninSpecifics& specifics) { - if (is_login_in_progress_) { - // If there is another login in progress, bail out. Do not re-enable - // clicking on other windows and the status area. Do not start the - // auto-login timer. - return; - } - - if (user_context.GetUserType() != user_manager::USER_TYPE_REGULAR && - user_manager::UserManager::Get()->IsUserLoggedIn()) { - // Multi-login is only allowed for regular users. If we are attempting to - // do multi-login as another type of user somehow, bail out. Do not - // re-enable clicking on other windows and the status area. Do not start the - // auto-login timer. - return; - } - if (user_context.GetUserType() == user_manager::USER_TYPE_GUEST) { if (!specifics.guest_mode_url.empty()) { guest_mode_url_ = GURL(specifics.guest_mode_url); diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 6e05725..9f5e098 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -1058,6 +1058,11 @@ void SigninScreenHandler::HandleRebootSystem() { } void SigninScreenHandler::HandleRemoveUser(const AccountId& account_id) { + if (delegate_ && + (delegate_->IsUserSigninCompleted() || delegate_->IsSigninInProgress())) { + return; + } + ProfileMetrics::LogProfileDeleteUser( ProfileMetrics::DELETE_PROFILE_USER_MANAGER); |