Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index f1025428c551178421403edade664ae285f8e397..41fba90826d4605eeb9329ceff933485d38c2700 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/chromeos/wm_ipc.h"
+#include "chrome/browser/profile_manager.h"
#include "chrome/browser/views/window.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
@@ -56,6 +57,9 @@ const size_t kNotSelected = -1;
// info bubble arrow to cursor.
const int kCursorOffset = 5;
+// Url for setting up sync authentication.
+const char kSettingsSyncLoginUrl[] = "chrome://settings/personal";
+
// Used to handle the asynchronous response of deleting a cryptohome directory.
class RemoveAttempt : public CryptohomeLibrary::Delegate {
public:
@@ -115,7 +119,8 @@ ExistingUserController::ExistingUserController(
selected_view_index_(kNotSelected),
num_login_attempts_(0),
bubble_(NULL),
- user_settings_(new UserCrosSettingsProvider()) {
+ user_settings_(new UserCrosSettingsProvider()),
+ two_factor_error_(false) {
if (delete_scheduled_instance_)
delete_scheduled_instance_->Delete();
@@ -378,6 +383,13 @@ void ExistingUserController::SelectUser(int index) {
}
}
+void ExistingUserController::SetLoginFailure(const LoginFailure& failure) {
+ if ((failure.reason() == LoginFailure::NETWORK_AUTH_FAILED &&
+ failure.error().state() == GoogleServiceAuthError::TWO_FACTOR)) {
+ two_factor_error_ = true;
+ }
+}
+
void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
std::string error = failure.GetErrorString();
@@ -486,9 +498,16 @@ void ExistingUserController::OnLoginSuccess(
login_performer_->set_delegate(NULL);
LoginPerformer* performer = login_performer_.release();
performer = NULL;
+ bool known_user = UserManager::Get()->IsKnownUser(username);
+ if (two_factor_error_ && !known_user && !start_url_.is_valid()) {
+ // If we have a two factor error and and this is a new user and we are not
+ // already directing the user to a start url (e.g. a help page),
+ // direct them to the personal settings page.
+ // TODO(stevenjb): direct the user to a lightweight sync login page.
+ start_url_ = GURL(kSettingsSyncLoginUrl);
+ }
AppendStartUrlToCmdline();
- if (selected_view_index_ + 1 == controllers_.size() &&
- !UserManager::Get()->IsKnownUser(username)) {
+ if (selected_view_index_ + 1 == controllers_.size() && !known_user) {
// For new user login don't launch browser until we pass image screen.
LoginUtils::Get()->EnableBrowserLaunch(false);
LoginUtils::Get()->CompleteLogin(username, password, credentials);

Powered by Google App Engine
This is Rietveld 408576698