Commit bd7a43fd authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

Chromad: Polishing to streamline domain join screen

Bug:945302, 869834

Change-Id: I047f6c54a1a6b197ea0faa1c6fe45abb8c8a43e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539044
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644727}
parent 08ea822f
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
</div> </div>
<div class="vertical layout"> <div class="vertical layout">
<cr-input slot="inputs" id="machineNameInput" required <cr-input slot="inputs" id="machineNameInput" required
hidden="[[!isDomainJoin]]" value="[[machineName]]" hidden="[[!isDomainJoin]]" value="{{machineName}}"
disabled="[[disabled]]" invalid="[[machineNameInvalid]]" disabled="[[disabled]]" invalid="[[machineNameInvalid]]"
pattern="[[machineNameInputPattern_]]" pattern="[[machineNameInputPattern_]]"
label="[[i18nDynamic(locale, 'oauthEnrollAdMachineNameInput')]]" label="[[i18nDynamic(locale, 'oauthEnrollAdMachineNameInput')]]"
......
...@@ -221,6 +221,10 @@ Polymer({ ...@@ -221,6 +221,10 @@ Polymer({
this.errorState == ACTIVE_DIRECTORY_ERROR_STATE.BAD_AUTH_PASSWORD; this.errorState == ACTIVE_DIRECTORY_ERROR_STATE.BAD_AUTH_PASSWORD;
this.unlockPasswordInvalid = this.unlockPasswordInvalid =
this.errorState == ACTIVE_DIRECTORY_ERROR_STATE.BAD_UNLOCK_PASSWORD; this.errorState == ACTIVE_DIRECTORY_ERROR_STATE.BAD_UNLOCK_PASSWORD;
// Clear password.
if (this.errorState == ACTIVE_DIRECTORY_ERROR_STATE.NONE)
this.$.passwordInput.value = '';
this.errorStateLocked_ = false; this.errorStateLocked_ = false;
}, },
......
...@@ -457,8 +457,8 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { ...@@ -457,8 +457,8 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
*/ */
setAdJoinConfiguration: function(options) { setAdJoinConfiguration: function(options) {
this.offlineAdUi_.disabled = false; this.offlineAdUi_.disabled = false;
this.offlineAdUi_.unlockPasswordStep = false;
this.offlineAdUi_.setJoinConfigurationOptions(options); this.offlineAdUi_.setJoinConfigurationOptions(options);
this.offlineAdUi_.unlockPasswordStep = false;
}, },
/** /**
......
...@@ -140,21 +140,21 @@ constexpr struct { ...@@ -140,21 +140,21 @@ constexpr struct {
IDS_AD_ENCRYPTION_LEGACY_SUBTITLE, IDS_AD_ENCRYPTION_LEGACY_SUBTITLE,
authpolicy::KerberosEncryptionTypes::ENC_TYPES_LEGACY}}; authpolicy::KerberosEncryptionTypes::ENC_TYPES_LEGACY}};
std::unique_ptr<base::ListValue> GetEncryptionTypesList() { base::ListValue GetEncryptionTypesList() {
const authpolicy::KerberosEncryptionTypes default_types = const authpolicy::KerberosEncryptionTypes default_types =
authpolicy::KerberosEncryptionTypes::ENC_TYPES_STRONG; authpolicy::KerberosEncryptionTypes::ENC_TYPES_STRONG;
auto encryption_list = std::make_unique<base::ListValue>(); base::ListValue encryption_list;
for (const auto& enc_types : kEncryptionTypes) { for (const auto& enc_types : kEncryptionTypes) {
auto enc_option = std::make_unique<base::DictionaryValue>(); base::DictionaryValue enc_option;
enc_option->SetKey( enc_option.SetKey(
"title", base::Value(l10n_util::GetStringUTF16(enc_types.title_id))); "title", base::Value(l10n_util::GetStringUTF16(enc_types.title_id)));
enc_option->SetKey( enc_option.SetKey(
"subtitle", "subtitle",
base::Value(l10n_util::GetStringUTF16(enc_types.subtitle_id))); base::Value(l10n_util::GetStringUTF16(enc_types.subtitle_id)));
enc_option->SetKey("value", base::Value(enc_types.id)); enc_option.SetKey("value", base::Value(enc_types.id));
enc_option->SetKey( enc_option.SetKey("selected",
"selected", base::Value(default_types == enc_types.encryption_types)); base::Value(default_types == enc_types.encryption_types));
encryption_list->Append(std::move(enc_option)); encryption_list.GetList().emplace_back(std::move(enc_option));
} }
return encryption_list; return encryption_list;
} }
...@@ -263,7 +263,6 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen( ...@@ -263,7 +263,6 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
if (!domain_join_config.empty()) { if (!domain_join_config.empty()) {
active_directory_domain_join_config_ = domain_join_config; active_directory_domain_join_config_ = domain_join_config;
show_unlock_password_ = true;
active_directory_join_type_ = active_directory_join_type_ =
ActiveDirectoryDomainJoinType::NOT_USING_CONFIGURATION; ActiveDirectoryDomainJoinType::NOT_USING_CONFIGURATION;
} }
...@@ -272,7 +271,8 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen( ...@@ -272,7 +271,8 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
std::string() /* machineName */, std::string() /* userName */, std::string() /* machineName */, std::string() /* userName */,
static_cast<int>(ActiveDirectoryErrorState::NONE), static_cast<int>(ActiveDirectoryErrorState::NONE),
show_unlock_password_); !active_directory_domain_join_config_
.empty() /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin); ShowStep(kEnrollmentStepAdJoin);
return; return;
} }
...@@ -285,28 +285,28 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen( ...@@ -285,28 +285,28 @@ void EnrollmentScreenHandler::ShowActiveDirectoryScreen(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name, CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username, username,
static_cast<int>(ActiveDirectoryErrorState::BAD_USERNAME), static_cast<int>(ActiveDirectoryErrorState::BAD_USERNAME),
show_unlock_password_); false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin); ShowStep(kEnrollmentStepAdJoin);
return; return;
case authpolicy::ERROR_BAD_PASSWORD: case authpolicy::ERROR_BAD_PASSWORD:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name, CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username, username,
static_cast<int>(ActiveDirectoryErrorState::BAD_AUTH_PASSWORD), static_cast<int>(ActiveDirectoryErrorState::BAD_AUTH_PASSWORD),
show_unlock_password_); false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin); ShowStep(kEnrollmentStepAdJoin);
return; return;
case authpolicy::ERROR_MACHINE_NAME_TOO_LONG: case authpolicy::ERROR_MACHINE_NAME_TOO_LONG:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name, CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username, username,
static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_TOO_LONG), static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_TOO_LONG),
show_unlock_password_); false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin); ShowStep(kEnrollmentStepAdJoin);
return; return;
case authpolicy::ERROR_INVALID_MACHINE_NAME: case authpolicy::ERROR_INVALID_MACHINE_NAME:
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name, CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", machine_name,
username, username,
static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_INVALID), static_cast<int>(ActiveDirectoryErrorState::MACHINE_NAME_INVALID),
show_unlock_password_); false /* show_unlock_password */);
ShowStep(kEnrollmentStepAdJoin); ShowStep(kEnrollmentStepAdJoin);
return; return;
case authpolicy::ERROR_PASSWORD_EXPIRED: case authpolicy::ERROR_PASSWORD_EXPIRED:
...@@ -620,7 +620,7 @@ void EnrollmentScreenHandler::DeclareLocalizedValues( ...@@ -620,7 +620,7 @@ void EnrollmentScreenHandler::DeclareLocalizedValues(
void EnrollmentScreenHandler::GetAdditionalParameters( void EnrollmentScreenHandler::GetAdditionalParameters(
base::DictionaryValue* parameters) { base::DictionaryValue* parameters) {
parameters->Set("encryptionTypesList", GetEncryptionTypesList()); parameters->SetKey("encryptionTypesList", GetEncryptionTypesList());
} }
bool EnrollmentScreenHandler::IsOnEnrollmentScreen() const { bool EnrollmentScreenHandler::IsOnEnrollmentScreen() const {
...@@ -638,17 +638,18 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked( ...@@ -638,17 +638,18 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked(
CallJS("login.OAuthEnrollmentScreen.setAdJoinParams", CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
std::string() /* machineName */, std::string() /* userName */, std::string() /* machineName */, std::string() /* userName */,
static_cast<int>(ActiveDirectoryErrorState::BAD_UNLOCK_PASSWORD), static_cast<int>(ActiveDirectoryErrorState::BAD_UNLOCK_PASSWORD),
show_unlock_password_); true /* show_unlock_password */);
return; return;
} }
std::unique_ptr<base::ListValue> options = active_directory_domain_join_config_.clear();
base::ListValue::From(base::JSONReader::ReadDeprecated( base::Optional<base::Value> options = base::JSONReader::Read(
unlocked_data, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS)); unlocked_data, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
if (!options) { if (!options || !options->is_list()) {
ShowError(IDS_AD_JOIN_CONFIG_NOT_PARSED, true); ShowError(IDS_AD_JOIN_CONFIG_NOT_PARSED, true);
show_unlock_password_ = false; CallJS("login.OAuthEnrollmentScreen.setAdJoinParams",
CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", std::string() /* machineName */, std::string() /* userName */,
base::ListValue()); static_cast<int>(ActiveDirectoryErrorState::NONE),
false /* show_unlock_password */);
return; return;
} }
base::DictionaryValue custom; base::DictionaryValue custom;
...@@ -656,7 +657,6 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked( ...@@ -656,7 +657,6 @@ void EnrollmentScreenHandler::OnAdConfigurationUnlocked(
"name", "name",
base::Value(l10n_util::GetStringUTF8(IDS_AD_CONFIG_SELECTION_CUSTOM))); base::Value(l10n_util::GetStringUTF8(IDS_AD_CONFIG_SELECTION_CUSTOM)));
options->GetList().push_back(std::move(custom)); options->GetList().push_back(std::move(custom));
show_unlock_password_ = false;
active_directory_join_type_ = active_directory_join_type_ =
ActiveDirectoryDomainJoinType::USING_CONFIGURATION; ActiveDirectoryDomainJoinType::USING_CONFIGURATION;
CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", *options); CallJS("login.OAuthEnrollmentScreen.setAdJoinConfiguration", *options);
...@@ -828,7 +828,6 @@ void EnrollmentScreenHandler::HandleAdCompleteLogin( ...@@ -828,7 +828,6 @@ void EnrollmentScreenHandler::HandleAdCompleteLogin(
const std::string& user_name, const std::string& user_name,
const std::string& password) { const std::string& password) {
observe_network_failure_ = false; observe_network_failure_ = false;
show_unlock_password_ = false;
DCHECK(controller_); DCHECK(controller_);
controller_->OnActiveDirectoryCredsProvided( controller_->OnActiveDirectoryCredsProvided(
machine_name, distinguished_name, machine_name, distinguished_name,
......
...@@ -170,9 +170,6 @@ class EnrollmentScreenHandler ...@@ -170,9 +170,6 @@ class EnrollmentScreenHandler
ActiveDirectoryDomainJoinType active_directory_join_type_ = ActiveDirectoryDomainJoinType active_directory_join_type_ =
ActiveDirectoryDomainJoinType::COUNT; ActiveDirectoryDomainJoinType::COUNT;
// Whether unlock password input step should be shown.
bool show_unlock_password_ = false;
// True if screen was not shown yet. // True if screen was not shown yet.
bool first_show_ = true; bool first_show_ = true;
......
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