Commit 1ab06323 authored by Danila Kuzmin's avatar Danila Kuzmin Committed by Commit Bot

oobe: Add error message for illegal enrollment for packaged EDU license

When user tries to enroll their CBEdu into a non-EDU account (e.g.
enterprise) they will see a new error message, added in this CL.

Bug: 1113395
Change-Id: Ib73244dc65e98be6c3497e9b711dae67411b897c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2465746Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Commit-Queue: Danila Kuzmin <dkuzmin@google.com>
Cr-Commit-Position: refs/heads/master@{#822104}
parent fb27f7ea
......@@ -3355,6 +3355,9 @@
<message name="IDS_ENTERPRISE_ENROLLMENT_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED" desc="Error message to show when the user tries to enroll a device, but administrator has not accepted TOS.">
Your administrator must first accept the terms of service in the Admin console Chrome device list.
</message>
<message name="IDS_ENTERPRISE_ENROLLMENT_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE" desc="Error message to show when the user tries to enroll a CBEdu device into non-EDU account.">
You must enroll this Chrome Education device into an education account. To sign up for a new account, please visit https://g.co/workspace/edusignup.
</message>
<message name="IDS_ENTERPRISE_ENROLLMENT_ATTRIBUTE_ERROR" desc="Error message shown when successfully enrolled, but the device attribute update has failed.">
Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> has successfully been enrolled for enterprise management, but failed to send its asset and location information. Please manually enter this information from your Admin console for this device.
</message>
......
......@@ -164,6 +164,7 @@ DemoSetupController::DemoSetupError CreateFromClientStatus(
case policy::DM_STATUS_SERVICE_ACTIVATION_PENDING:
case policy::DM_STATUS_SERVICE_ENTERPRISE_ACCOUNT_IS_NOT_ELIGIBLE_TO_ENROLL:
case policy::DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED:
case policy::DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE:
return DemoSetupController::DemoSetupError(ErrorCode::kDemoAccountError,
RecoveryMethod::kUnknown,
debug_message);
......
......@@ -440,6 +440,21 @@ IN_PROC_BROWSER_TEST_F(EnrollmentLocalPolicyServerBase,
EXPECT_FALSE(InstallAttributes::Get()->IsEnterpriseManaged());
}
IN_PROC_BROWSER_TEST_F(EnrollmentLocalPolicyServerBase,
EnrollmentErrorIllegalAccountForPackagedEDULicense) {
policy_server_.SetExpectedDeviceEnrollmentError(907);
TriggerEnrollmentAndSignInSuccessfully();
enrollment_ui_.WaitForStep(test::ui::kEnrollmentStepError);
enrollment_ui_.ExpectErrorMessage(
IDS_ENTERPRISE_ENROLLMENT_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE,
/* can retry */ true);
enrollment_ui_.RetryAfterError();
EXPECT_FALSE(StartupUtils::IsDeviceRegistered());
EXPECT_FALSE(InstallAttributes::Get()->IsEnterpriseManaged());
}
// Error during enrollment : Strange HTTP response from server.
IN_PROC_BROWSER_TEST_F(EnrollmentLocalPolicyServerBase,
EnrollmentErrorServerIsDrunk) {
......
......@@ -462,6 +462,9 @@ void EnterpriseEnrollmentHelperImpl::ReportEnrollmentStatus(
case policy::DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED:
UMA(policy::kMetricEnrollmentRegisterEnterpriseTosHasNotBeenAccepted);
break;
case policy::DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE:
UMA(policy::kMetricEnrollmentIllegalAccountForPackagedEDULicense);
break;
}
break;
case policy::EnrollmentStatus::REGISTRATION_BAD_MODE:
......
......@@ -426,6 +426,11 @@ void EnrollmentScreenHandler::ShowEnrollmentStatus(
IDS_ENTERPRISE_ENROLLMENT_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED,
true);
break;
case policy::DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE:
ShowError(
IDS_ENTERPRISE_ENROLLMENT_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE,
true);
break;
default:
ShowErrorMessage(
l10n_util::GetStringFUTF8(
......
......@@ -62,6 +62,8 @@ int GetIDSForDMStatus(DeviceManagementStatus status) {
case DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED:
// This is shown only on registration failed.
return IDS_POLICY_DM_STATUS_UNKNOWN_ERROR;
case DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE:
return IDS_POLICY_DM_STATUS_SERVICE_DOMAIN_MISMATCH;
}
NOTREACHED() << "Unhandled DM status " << status;
return IDS_POLICY_DM_STATUS_UNKNOWN_ERROR;
......
......@@ -141,6 +141,8 @@ enum DeviceManagementStatus {
DM_STATUS_SERVICE_ENTERPRISE_ACCOUNT_IS_NOT_ELIGIBLE_TO_ENROLL = 906,
// Service error: Enterprise TOS has not been accepted.
DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED = 907,
// Service error: Illegal account for packaged EDU license.
DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE = 908,
};
// List of modes that the device can be locked into.
......
......@@ -328,6 +328,7 @@ void CloudPolicyRefreshScheduler::ScheduleRefresh() {
case DM_STATUS_SERVICE_CONSUMER_ACCOUNT_WITH_PACKAGED_LICENSE:
case DM_STATUS_SERVICE_ENTERPRISE_ACCOUNT_IS_NOT_ELIGIBLE_TO_ENROLL:
case DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED:
case DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE:
// Need a re-registration, no use in retrying.
CancelRefresh();
return;
......
......@@ -546,6 +546,7 @@ static const ClientErrorTestParam kClientErrorTestCases[] = {
{DM_STATUS_SERVICE_ENTERPRISE_ACCOUNT_IS_NOT_ELIGIBLE_TO_ENROLL, -1, 1},
{DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED, -1, 1},
{DM_STATUS_SERVICE_TOO_MANY_REQUESTS, kPolicyRefreshRate, 1},
{DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE, -1, 1},
};
class CloudPolicyRefreshSchedulerClientErrorTest
......
......@@ -126,6 +126,7 @@ const int DeviceManagementService::kDeprovisioned;
const int DeviceManagementService::kArcDisabled;
const int DeviceManagementService::kInvalidDomainlessCustomer;
const int DeviceManagementService::kTosHasNotBeenAccepted;
const int DeviceManagementService::kIllegalAccountForPackagedEDULicense;
// static
std::string DeviceManagementService::JobConfiguration::GetJobTypeAsString(
......
......@@ -88,6 +88,7 @@ class POLICY_EXPORT DeviceManagementService {
static constexpr int kArcDisabled = 904;
static constexpr int kInvalidDomainlessCustomer = 905;
static constexpr int kTosHasNotBeenAccepted = 906;
static constexpr int kIllegalAccountForPackagedEDULicense = 907;
// Number of times to retry on ERR_NETWORK_CHANGED errors.
static const int kMaxRetries = 3;
......
......@@ -463,6 +463,11 @@ INSTANTIATE_TEST_SUITE_P(
net::OK,
906,
PROTO_STRING(kResponseEmpty)),
FailedRequestParams(
DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE,
net::OK,
907,
PROTO_STRING(kResponseEmpty)),
FailedRequestParams(DM_STATUS_REQUEST_TOO_LARGE,
net::OK,
413,
......
......@@ -204,6 +204,9 @@ DMServerJobConfiguration::MapNetErrorAndResponseCodeToDMStatus(
case DeviceManagementService::kTosHasNotBeenAccepted:
code = DM_STATUS_SERVICE_ENTERPRISE_TOS_HAS_NOT_BEEN_ACCEPTED;
break;
case DeviceManagementService::kIllegalAccountForPackagedEDULicense:
code = DM_STATUS_SERVICE_ILLEGAL_ACCOUNT_FOR_PACKAGED_EDU_LICENSE;
break;
default:
// Handle all unknown 5xx HTTP error codes as temporary and any other
// unknown error as one that needs more time to recover.
......
......@@ -140,8 +140,10 @@ enum MetricEnrollment {
kMetricEnrollmentRegisterEnterpriseTosHasNotBeenAccepted = 61,
// Too many requests are uploadede within a short time.
kMetricEnrollmentTooManyRequests = 62,
// Enrollment failed: illegal account for packaged EDU license.
kMetricEnrollmentIllegalAccountForPackagedEDULicense = 63,
// Max value for use with enumeration histogram UMA functions.
kMaxValue = kMetricEnrollmentTooManyRequests
kMaxValue = kMetricEnrollmentIllegalAccountForPackagedEDULicense
};
// Events related to policy refresh.
......
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