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

Unified 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: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/authenticator.cc
diff --git a/chrome/browser/chromeos/login/authenticator.cc b/chrome/browser/chromeos/login/authenticator.cc
index 57426b3faed34ad9ab02e41c3e23d33c0ec5cd04..97abe06454019fae5b9b6e6337820c01bcc905ee 100644
--- a/chrome/browser/chromeos/login/authenticator.cc
+++ b/chrome/browser/chromeos/login/authenticator.cc
@@ -40,6 +40,13 @@ std::string Authenticator::Canonicalize(const std::string& email_address) {
}
// static
+std::string Authenticator::CanonicalizeDomain(const std::string& domain) {
+ // Canonicalization of domain names means lower-casing them. Make sure to
+ // update this function in sync with Canonicalize if this ever changes.
+ return StringToLowerASCII(domain);
+}
+
+// static
std::string Authenticator::Sanitize(const std::string& email_address) {
std::string sanitized(email_address);
@@ -52,4 +59,16 @@ std::string Authenticator::Sanitize(const std::string& email_address) {
return sanitized;
}
+// static
+std::string Authenticator::ExtractDomainName(const std::string& email_address) {
+ // First canonicalize which will also verify we have proper domain part.
+ std::string email = Canonicalize(email_address);
+ size_t separator_pos = email.find('@');
+ if (separator_pos != email.npos && separator_pos < email.length() - 1)
+ return email.substr(separator_pos + 1);
+ else
+ NOTREACHED() << "Not a proper email address: " << email;
+ return std::string();
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/authenticator.h ('k') | chrome/browser/chromeos/login/authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698