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

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

Issue 10443125: Allow re-enrollment to the same domain in case of policy data loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved the domain extraction to Authenticator and added custom error message. Created 8 years, 6 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/authenticator.h" 5 #include "chrome/browser/chromeos/login/authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Apply a default domain if necessary. 46 // Apply a default domain if necessary.
47 if (sanitized.find('@') == std::string::npos) { 47 if (sanitized.find('@') == std::string::npos) {
48 sanitized += '@'; 48 sanitized += '@';
49 sanitized += kGmailDomain; 49 sanitized += kGmailDomain;
50 } 50 }
51 51
52 return sanitized; 52 return sanitized;
53 } 53 }
54 54
55 // static
56 std::string Authenticator::ExtractDomainName(const std::string& email_address) {
57 // First canonicalize which will also verify we have proper domain part.
58 std::string email = Canonicalize(email_address);
59 size_t separator_pos = email.find('@');
60 if (separator_pos != email.npos && separator_pos < email.length() - 1)
61 return email.substr(separator_pos + 1);
62 else
63 NOTREACHED() << "Not a proper email address: " << email;
64 return std::string();
65 }
66
55 } // namespace chromeos 67 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698