From e3712a768be3688524e6a75e0d29f72dafd320ef Mon Sep 17 00:00:00 2001 From: "dpolukhin@chromium.org" Date: Fri, 14 May 2010 06:40:47 +0000 Subject: Clear password filed on failed login. BUG=crosbug.com/1853 TEST=Type wrong password and press Enter. Review URL: http://codereview.chromium.org/2086001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47246 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/login/existing_user_controller.cc | 2 +- chrome/browser/chromeos/login/user_controller.cc | 5 +++++ chrome/browser/chromeos/login/user_controller.h | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 80a5f8b..3b51ce1 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -161,7 +161,7 @@ void ExistingUserController::OnLoginFailure(const std::string& error) { ShowError(IDS_LOGIN_ERROR_AUTHENTICATING); } - controllers_[index_of_view_logging_in_]->SetPasswordEnabled(true); + controllers_[index_of_view_logging_in_]->ClearAndEnablePassword(); // Reenable clicking on other windows. WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE); diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc index 5321f8a..23215e3 100644 --- a/chrome/browser/chromeos/login/user_controller.cc +++ b/chrome/browser/chromeos/login/user_controller.cc @@ -117,6 +117,11 @@ void UserController::SetPasswordEnabled(bool enable) { submit_button_->SetEnabled(enable); } +void UserController::ClearAndEnablePassword() { + password_field_->SetText(string16()); + SetPasswordEnabled(true); +} + void UserController::ButtonPressed(views::Button* sender, const views::Event& event) { Login(); diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h index 5d7cde8..61d02ec 100644 --- a/chrome/browser/chromeos/login/user_controller.h +++ b/chrome/browser/chromeos/login/user_controller.h @@ -50,8 +50,8 @@ class UserController : public views::ButtonListener, const UserManager::User& user() const { return user_; } - // Sets the enabled state of the password field to |enable|. - void SetPasswordEnabled(bool enable); + // Resets password text and sets the enabled state of the password. + void ClearAndEnablePassword(); // Returns bounds of password field in screen coordinates. gfx::Rect GetScreenBounds() const; @@ -100,6 +100,9 @@ class UserController : public views::ButtonListener, // when needed. void SetImage(const SkBitmap& image, int desired_width, int desired_height); + // Sets the enabled state of the password field to |enable|. + void SetPasswordEnabled(bool enable); + // Is this the guest user? const bool is_guest_; -- cgit v1.1