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

Side by Side Diff: chrome/browser/chromeos/login/google_authenticator.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored 2-factor error passing 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/google_authenticator.h" 5 #include "chrome/browser/chromeos/login/google_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 failure_details)); 234 failure_details));
235 LOG(WARNING) << "Rejecting valid HOSTED account."; 235 LOG(WARNING) << "Rejecting valid HOSTED account.";
236 hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed; 236 hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
237 return; 237 return;
238 } 238 }
239 239
240 ClearClientLoginAttempt(); 240 ClearClientLoginAttempt();
241 241
242 if (error.state() == GoogleServiceAuthError::TWO_FACTOR) { 242 if (error.state() == GoogleServiceAuthError::TWO_FACTOR) {
243 LOG(WARNING) << "Two factor authenticated. Sync will not work."; 243 LOG(WARNING) << "Two factor authenticated. Sync will not work.";
244 OnClientLoginSuccess(GaiaAuthConsumer::ClientLoginResult()); 244 GaiaAuthConsumer::ClientLoginResult result;
245 result.two_factor = true;
246 OnClientLoginSuccess(result);
245 return; 247 return;
246 } 248 }
247 249
248 BrowserThread::PostTask( 250 BrowserThread::PostTask(
249 BrowserThread::FILE, FROM_HERE, 251 BrowserThread::FILE, FROM_HERE,
250 NewRunnableMethod(this, 252 NewRunnableMethod(this,
251 &GoogleAuthenticator::LoadLocalaccount, 253 &GoogleAuthenticator::LoadLocalaccount,
252 std::string(kLocalaccountFile))); 254 std::string(kLocalaccountFile)));
253 255
254 LoginFailure failure_details = LoginFailure::FromNetworkAuthFailure(error); 256 LoginFailure failure_details = LoginFailure::FromNetworkAuthFailure(error);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 const unsigned int len) { 482 const unsigned int len) {
481 if (len < 2*binary_len) 483 if (len < 2*binary_len)
482 return false; 484 return false;
483 memset(hex_string, 0, len); 485 memset(hex_string, 0, len);
484 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) 486 for (uint i = 0, j = 0; i < binary_len; i++, j+=2)
485 snprintf(hex_string + j, len - j, "%02x", binary[i]); 487 snprintf(hex_string + j, len - j, "%02x", binary[i]);
486 return true; 488 return true;
487 } 489 }
488 490
489 } // namespace chromeos 491 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698