summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authorkaren@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-20 20:35:50 +0000
committerkaren@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-20 20:35:50 +0000
commitbc53c2cdcba773e56131e8810ce346d27982b79f (patch)
treeb853c99f6a507b1e45d409cd9ff00945f905c4f5 /chrome/browser/chromeos
parentebb1d5806faab39f4fcbc4a1261c47c3ebeda96a (diff)
downloadchromium_src-bc53c2cdcba773e56131e8810ce346d27982b79f.zip
chromium_src-bc53c2cdcba773e56131e8810ce346d27982b79f.tar.gz
chromium_src-bc53c2cdcba773e56131e8810ce346d27982b79f.tar.bz2
Merge 143211 - [cros] Add incorrect password error message on changed password flow.
BUG=129496 TEST=Manual. Change password, try to sign in, enter incorrect old password. Review URL: https://chromiumcodereview.appspot.com/10572037 TBR=nkostylev@chromium.org Review URL: https://chromiumcodereview.appspot.com/10577043 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@143248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc9
-rw-r--r--chrome/browser/chromeos/login/login_performer.cc2
-rw-r--r--chrome/browser/chromeos/login/login_performer.h10
-rw-r--r--chrome/browser/chromeos/login/password_changed_view.cc24
-rw-r--r--chrome/browser/chromeos/login/password_changed_view.h11
5 files changed, 51 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 8bdf93c..7e275ed 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -653,12 +653,19 @@ void ExistingUserController::OnPasswordChangeDetected() {
return;
}
+ // True if user has already made an attempt to enter old password and failed.
+ bool show_invalid_old_password_error =
+ login_performer_->password_changed_callback_count() > 1;
+
// Passing 'false' here enables "full sync" mode in the dialog,
// which disables the requirement for the old owner password,
// allowing us to recover from a lost owner password/homedir.
// TODO(gspencer): We shouldn't have to erase stateful data when
// doing this. See http://crosbug.com/9115 http://crosbug.com/7792
- PasswordChangedView* view = new PasswordChangedView(this, false);
+ PasswordChangedView* view = new PasswordChangedView(
+ this,
+ false, // Allow removal of existing cryptohome, perform full migration.
+ show_invalid_old_password_error);
views::Widget* window = views::Widget::CreateWindowWithParent(
view, GetNativeWindow());
window->SetAlwaysOnTop(true);
diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc
index 7db24fb..4ceb8bf 100644
--- a/chrome/browser/chromeos/login/login_performer.cc
+++ b/chrome/browser/chromeos/login/login_performer.cc
@@ -54,6 +54,7 @@ LoginPerformer::LoginPerformer(Delegate* delegate)
last_login_failure_(LoginFailure::None()),
delegate_(delegate),
password_changed_(false),
+ password_changed_callback_count_(0),
screen_lock_requested_(false),
initial_online_auth_pending_(false),
auth_mode_(AUTH_MODE_INTERNAL),
@@ -212,6 +213,7 @@ void LoginPerformer::OnOffTheRecordLoginSuccess() {
void LoginPerformer::OnPasswordChangeDetected() {
password_changed_ = true;
+ password_changed_callback_count_++;
if (delegate_) {
delegate_->OnPasswordChangeDetected();
} else {
diff --git a/chrome/browser/chromeos/login/login_performer.h b/chrome/browser/chromeos/login/login_performer.h
index 32d509f0..10d86c2 100644
--- a/chrome/browser/chromeos/login/login_performer.h
+++ b/chrome/browser/chromeos/login/login_performer.h
@@ -117,6 +117,15 @@ class LoginPerformer : public LoginStatusConsumer,
// True if password change has been detected.
bool password_changed() { return password_changed_; }
+ // Number of times we've been called with OnPasswordChangeDetected().
+ // If user enters incorrect old password, same LoginPerformer instance will
+ // be called so callback count makes it possible to distinguish initial
+ // "password changed detected" event from further attempts to enter old
+ // password for cryptohome migration (when > 1).
+ int password_changed_callback_count() {
+ return password_changed_callback_count_;
+ }
+
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
typedef enum AuthorizationMode {
@@ -191,6 +200,7 @@ class LoginPerformer : public LoginStatusConsumer,
// True if password change has been detected.
// Once correct password is entered homedir migration is executed.
bool password_changed_;
+ int password_changed_callback_count_;
// Used for ScreenLock notifications.
content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc
index 785870f..4fd05bd 100644
--- a/chrome/browser/chromeos/login/password_changed_view.cc
+++ b/chrome/browser/chromeos/login/password_changed_view.cc
@@ -34,14 +34,17 @@ const int kPasswordFieldWidthChars = 20;
} // namespace
PasswordChangedView::PasswordChangedView(Delegate* delegate,
- bool full_sync_disabled)
+ bool full_sync_disabled,
+ bool show_invalid_old_password_error)
: title_label_(NULL),
description_label_(NULL),
full_sync_radio_(NULL),
delta_sync_radio_(NULL),
old_password_field_(NULL),
+ password_error_label_(NULL),
delegate_(delegate),
- full_sync_disabled_(full_sync_disabled) {
+ full_sync_disabled_(full_sync_disabled),
+ show_invalid_old_password_error_(show_invalid_old_password_error) {
}
bool PasswordChangedView::Accept() {
@@ -125,6 +128,16 @@ void PasswordChangedView::Init() {
old_password_field_->set_default_width_in_chars(kPasswordFieldWidthChars);
old_password_field_->SetController(this);
+ if (show_invalid_old_password_error_) {
+ password_error_label_ = new Label();
+ // TODO(nkostylev): Add separate string on TOT.
+ password_error_label_->SetText(
+ l10n_util::GetStringUTF16(IDS_NETWORK_CONFIG_ERROR_INCORRECT_PASSWORD));
+ password_error_label_->SetMultiLine(true);
+ password_error_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
+ password_error_label_->SetEnabledColor(SK_ColorRED);
+ }
+
// Define controls layout.
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
@@ -153,6 +166,13 @@ void PasswordChangedView::Init() {
layout->StartRow(0, 1);
layout->AddView(
old_password_field_, 1, 1, GridLayout::LEADING, GridLayout::CENTER);
+
+ if (show_invalid_old_password_error_) {
+ layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
+ layout->StartRow(0, 1);
+ layout->AddView(
+ password_error_label_, 1, 1, GridLayout::LEADING, GridLayout::CENTER);
+ }
layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
layout->StartRow(0, 0);
diff --git a/chrome/browser/chromeos/login/password_changed_view.h b/chrome/browser/chromeos/login/password_changed_view.h
index 48d0e28..6128a10a 100644
--- a/chrome/browser/chromeos/login/password_changed_view.h
+++ b/chrome/browser/chromeos/login/password_changed_view.h
@@ -42,7 +42,9 @@ class PasswordChangedView : public views::DialogDelegateView,
virtual void ResyncEncryptedData() = 0;
};
- PasswordChangedView(Delegate* delegate, bool full_sync_disabled);
+ PasswordChangedView(Delegate* delegate,
+ bool full_sync_disabled,
+ bool show_invalid_old_password_error);
virtual ~PasswordChangedView() {}
// views::DialogDelegate:
@@ -87,12 +89,17 @@ class PasswordChangedView : public views::DialogDelegateView,
views::RadioButton* full_sync_radio_;
views::RadioButton* delta_sync_radio_;
views::Textfield* old_password_field_;
+ views::Label* password_error_label_;
// Notifications receiver.
Delegate* delegate_;
// Whether full sync option is disabled.
- bool full_sync_disabled_;
+ const bool full_sync_disabled_;
+
+ // Whether should show "Incorrect password" error message
+ // i.e. dialog is opened second time after incorrect old password input try.
+ const bool show_invalid_old_password_error_;
DISALLOW_COPY_AND_ASSIGN(PasswordChangedView);
};