Commit d32f9897 authored by Yusuf Sengul's avatar Yusuf Sengul Committed by Commit Bot

Update allowed domains error message

Bug: 1119466
Change-Id: Iba472f30a4e5f9625f85a94d1a8e1d67999961cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363216Reviewed-by: default avatarRakesh Soma <rakeshsoma@google.com>
Commit-Queue: Yusuf Sengul <yusufsn@google.com>
Cr-Commit-Position: refs/heads/master@{#801842}
parent eb03cf17
...@@ -120,24 +120,6 @@ base::string16 GetEmailDomains() { ...@@ -120,24 +120,6 @@ base::string16 GetEmailDomains() {
return email_domains_reg.empty() ? email_domains_reg_new : email_domains_reg; return email_domains_reg.empty() ? email_domains_reg_new : email_domains_reg;
} }
// Get a pretty-printed string of the list of email domains that we can display
// to the end-user.
base::string16 GetEmailDomainsPrintableString() {
base::string16 email_domains_reg = GetEmailDomains();
if (email_domains_reg.empty())
return email_domains_reg;
std::vector<base::string16> domains =
base::SplitString(base::ToLowerASCII(email_domains_reg),
base::ASCIIToUTF16(kEmailDomainsSeparator),
base::WhitespaceHandling::TRIM_WHITESPACE,
base::SplitResult::SPLIT_WANT_NONEMPTY);
base::string16 email_domains_str =
base::JoinString(domains, base::string16(L", "));
return email_domains_str;
}
// Use WinHttpUrlFetcher to communicate with the admin sdk and fetch the active // Use WinHttpUrlFetcher to communicate with the admin sdk and fetch the active
// directory samAccountName if available and list of local account name mapping // directory samAccountName if available and list of local account name mapping
// configured as custom attributes. // configured as custom attributes.
...@@ -655,7 +637,7 @@ HRESULT ValidateResult(const base::Value& result, BSTR* status_text) { ...@@ -655,7 +637,7 @@ HRESULT ValidateResult(const base::Value& result, BSTR* status_text) {
break; break;
case kUiecInvalidEmailDomain: case kUiecInvalidEmailDomain:
*status_text = CGaiaCredentialBase::AllocErrorString( *status_text = CGaiaCredentialBase::AllocErrorString(
IDS_INVALID_EMAIL_DOMAIN_BASE, {GetEmailDomainsPrintableString()}); IDS_INVALID_EMAIL_DOMAIN_BASE);
break; break;
case kUiecMissingSigninData: case kUiecMissingSigninData:
*status_text = *status_text =
......
...@@ -672,33 +672,6 @@ class GcpGaiaCredentialBaseInvalidDomainTest ...@@ -672,33 +672,6 @@ class GcpGaiaCredentialBaseInvalidDomainTest
: public GcpGaiaCredentialBaseTest, : public GcpGaiaCredentialBaseTest,
public ::testing::WithParamInterface< public ::testing::WithParamInterface<
std::tuple<const wchar_t*, const wchar_t*>> { std::tuple<const wchar_t*, const wchar_t*>> {
public:
// Get a pretty-printed string of the list of email domains that we can
// display to the end-user.
base::string16 GetEmailDomainsPrintableString() {
base::string16 email_domains_reg_old = GetGlobalFlagOrDefault(L"ed", L"");
base::string16 email_domains_reg_new =
GetGlobalFlagOrDefault(L"domains_allowed_to_login", L"");
base::string16 email_domains_reg = email_domains_reg_old.empty()
? email_domains_reg_new
: email_domains_reg_old;
if (email_domains_reg.empty())
return email_domains_reg;
std::vector<base::string16> domains =
base::SplitString(base::ToLowerASCII(email_domains_reg),
base::ASCIIToUTF16(kEmailDomainsSeparator),
base::WhitespaceHandling::TRIM_WHITESPACE,
base::SplitResult::SPLIT_WANT_NONEMPTY);
base::string16 email_domains_str;
for (size_t i = 0; i < domains.size(); ++i) {
email_domains_str += domains[i];
if (i < domains.size() - 1)
email_domains_str += L", ";
}
return email_domains_str;
}
}; };
TEST_P(GcpGaiaCredentialBaseInvalidDomainTest, Fail) { TEST_P(GcpGaiaCredentialBaseInvalidDomainTest, Fail) {
...@@ -728,9 +701,8 @@ TEST_P(GcpGaiaCredentialBaseInvalidDomainTest, Fail) { ...@@ -728,9 +701,8 @@ TEST_P(GcpGaiaCredentialBaseInvalidDomainTest, Fail) {
ASSERT_EQ(S_OK, StartLogonProcessAndWait()); ASSERT_EQ(S_OK, StartLogonProcessAndWait());
base::string16 expected_error_msg = base::ReplaceStringPlaceholders( base::string16 expected_error_msg =
GetStringResource(IDS_INVALID_EMAIL_DOMAIN_BASE), GetStringResource(IDS_INVALID_EMAIL_DOMAIN_BASE);
{GetEmailDomainsPrintableString()}, nullptr);
// Logon process should fail with the specified error message. // Logon process should fail with the specified error message.
ASSERT_EQ(S_OK, FinishLogonProcess(false, false, expected_error_msg)); ASSERT_EQ(S_OK, FinishLogonProcess(false, false, expected_error_msg));
...@@ -748,33 +720,6 @@ class GcpGaiaCredentialBasePermittedAccountTest ...@@ -748,33 +720,6 @@ class GcpGaiaCredentialBasePermittedAccountTest
: public GcpGaiaCredentialBaseTest, : public GcpGaiaCredentialBaseTest,
public ::testing::WithParamInterface< public ::testing::WithParamInterface<
std::tuple<const wchar_t*, const wchar_t*>> { std::tuple<const wchar_t*, const wchar_t*>> {
public:
// Get a pretty-printed string of the list of email domains that we can
// display to the end-user.
base::string16 GetEmailDomainsPrintableString() {
base::string16 email_domains_reg_old = GetGlobalFlagOrDefault(L"ed", L"");
base::string16 email_domains_reg_new =
GetGlobalFlagOrDefault(L"domains_allowed_to_login", L"");
base::string16 email_domains_reg = email_domains_reg_old.empty()
? email_domains_reg_new
: email_domains_reg_old;
if (email_domains_reg.empty())
return email_domains_reg;
std::vector<base::string16> domains =
base::SplitString(base::ToLowerASCII(email_domains_reg),
base::ASCIIToUTF16(kEmailDomainsSeparator),
base::WhitespaceHandling::TRIM_WHITESPACE,
base::SplitResult::SPLIT_WANT_NONEMPTY);
base::string16 email_domains_str;
for (size_t i = 0; i < domains.size(); ++i) {
email_domains_str += domains[i];
if (i < domains.size() - 1)
email_domains_str += L", ";
}
return email_domains_str;
}
}; };
TEST_P(GcpGaiaCredentialBasePermittedAccountTest, PermittedAccounts) { TEST_P(GcpGaiaCredentialBasePermittedAccountTest, PermittedAccounts) {
...@@ -813,9 +758,7 @@ TEST_P(GcpGaiaCredentialBasePermittedAccountTest, PermittedAccounts) { ...@@ -813,9 +758,7 @@ TEST_P(GcpGaiaCredentialBasePermittedAccountTest, PermittedAccounts) {
} else { } else {
base::string16 expected_error_msg; base::string16 expected_error_msg;
if (!found_domain) { if (!found_domain) {
expected_error_msg = base::ReplaceStringPlaceholders( expected_error_msg = GetStringResource(IDS_INVALID_EMAIL_DOMAIN_BASE);
GetStringResource(IDS_INVALID_EMAIL_DOMAIN_BASE),
{GetEmailDomainsPrintableString()}, nullptr);
} else { } else {
expected_error_msg = GetStringResource(IDS_EMAIL_MISMATCH_BASE); expected_error_msg = GetStringResource(IDS_EMAIL_MISMATCH_BASE);
} }
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
Your administrator doesn’t allow you to sign in with this account. Try a different account. Your administrator doesn’t allow you to sign in with this account. Try a different account.
</message> </message>
<message name="IDS_INVALID_EMAIL_DOMAIN" desc=""> <message name="IDS_INVALID_EMAIL_DOMAIN" desc="">
You can sign in only with an email address that ends with the following: <ph name="EMAIL_DOMAINS">$1<ex>acme.com, acme2.com, acme3.com</ex></ph>. Try again using a work account. This email isn't allowed to sign in. Try again with the account you use for work or school. If you still can't sign in, contact your administrator.
</message> </message>
<message name="IDS_DISALLOWED_CONSUMER_EMAIL" desc=""> <message name="IDS_DISALLOWED_CONSUMER_EMAIL" desc="">
Signing in with a personal account on this device is not allowed. Please login with a work account. Signing in with a personal account on this device is not allowed. Please login with a work account.
......
81dbc05a79e6efdca1a6d59b3686a8b0171ba05f a502feb50478237f2e26446c661f23cb17299fc7
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment