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

Unified Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 2602973002: Add Active Directory password change screen. (Closed)
Patch Set: nits Created 3 years, 11 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/ui/webui/chromeos/login/gaia_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index 03933fc25f1c9ff75e16a705df62d141f6665a71..efacc14e60a9c43138d33aac7a561b9dbacf211b 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -416,6 +416,8 @@ void GaiaScreenHandler::RegisterMessages() {
&GaiaScreenHandler::HandleAuthExtensionLoaded);
AddCallback("completeAdAuthentication",
&GaiaScreenHandler::HandleCompleteAdAuthentication);
+ AddCallback("completeAdPasswordChange",
+ &GaiaScreenHandler::HandleCompleteAdPasswordChange);
}
void GaiaScreenHandler::OnPortalDetectionCompleted(
@@ -503,36 +505,74 @@ void GaiaScreenHandler::DoAdAuth(const std::string& username,
const Key& key,
authpolicy::ErrorType error,
const std::string& uid) {
- if (error == authpolicy::ERROR_NONE && !uid.empty()) {
- const AccountId account_id(
- GetAccountId(username, uid, AccountType::ACTIVE_DIRECTORY));
- UserContext user_context(account_id);
- user_context.SetKey(key);
- user_context.SetAuthFlow(UserContext::AUTH_FLOW_ACTIVE_DIRECTORY);
- user_context.SetIsUsingOAuth(false);
- user_context.SetUserType(
- user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY);
- Delegate()->CompleteLogin(user_context);
- } else {
- // TODO(rsorokin): Proper error handling.
- DLOG(ERROR) << "Failed to auth " << username << ", code " << error;
- LoadAuthExtension(true, false /* offline */);
+ switch (error) {
+ case authpolicy::ERROR_NONE: {
+ DCHECK(!uid.empty());
+ const AccountId account_id(
+ GetAccountId(username, uid, AccountType::ACTIVE_DIRECTORY));
+ UserContext user_context(account_id);
+ user_context.SetKey(key);
+ user_context.SetAuthFlow(UserContext::AUTH_FLOW_ACTIVE_DIRECTORY);
+ user_context.SetIsUsingOAuth(false);
+ user_context.SetUserType(
+ user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY);
+ Delegate()->CompleteLogin(user_context);
+ break;
+ }
+ case authpolicy::ERROR_PASSWORD_EXPIRED:
+ core_oobe_actor_->ShowActiveDirectoryPasswordChangeScreen(username);
+ break;
+ case authpolicy::ERROR_UNKNOWN:
+ case authpolicy::ERROR_DBUS_FAILURE:
+ case authpolicy::ERROR_PARSE_UPN_FAILED:
+ case authpolicy::ERROR_BAD_USER_NAME:
+ case authpolicy::ERROR_BAD_PASSWORD:
+ case authpolicy::ERROR_CANNOT_RESOLVE_KDC:
+ case authpolicy::ERROR_KINIT_FAILED:
+ case authpolicy::ERROR_NET_FAILED:
+ case authpolicy::ERROR_SMBCLIENT_FAILED:
+ case authpolicy::ERROR_PARSE_FAILED:
+ case authpolicy::ERROR_PARSE_PREG_FAILED:
+ case authpolicy::ERROR_BAD_GPOS:
+ case authpolicy::ERROR_LOCAL_IO:
+ case authpolicy::ERROR_NOT_JOINED:
+ case authpolicy::ERROR_NOT_LOGGED_IN:
+ case authpolicy::ERROR_STORE_POLICY_FAILED:
+ LoadAuthExtension(true, false /* offline */);
+ break;
+ default:
+ // TODO(rsorokin): Proper error handling.
+ DLOG(WARNING) << "Unhandled error code: " << error;
+ LoadAuthExtension(true, false /* offline */);
}
}
void GaiaScreenHandler::HandleCompleteAdAuthentication(
- const std::string& user_name,
+ const std::string& username,
const std::string& password) {
- Delegate()->SetDisplayEmail(user_name);
- set_populated_email(user_name);
+ Delegate()->SetDisplayEmail(username);
+ set_populated_email(username);
login::GetPipeReadEnd(
password,
base::Bind(&GaiaScreenHandler::OnPasswordPipeReady,
- weak_factory_.GetWeakPtr(), user_name, Key(password)));
+ weak_factory_.GetWeakPtr(), username, Key(password)));
+}
+
+void GaiaScreenHandler::HandleCompleteAdPasswordChange(
+ const std::string& username,
+ const std::string& old_password,
+ const std::string& new_password) {
+ Delegate()->SetDisplayEmail(username);
+ set_populated_email(username);
+
+ login::GetPipeReadEnd(
+ old_password + "\n" + new_password + "\n" + new_password,
+ base::Bind(&GaiaScreenHandler::OnPasswordPipeReady,
+ weak_factory_.GetWeakPtr(), username, Key(new_password)));
}
-void GaiaScreenHandler::OnPasswordPipeReady(const std::string& user_name,
+void GaiaScreenHandler::OnPasswordPipeReady(const std::string& username,
const Key& key,
base::ScopedFD password_fd) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -543,9 +583,9 @@ void GaiaScreenHandler::OnPasswordPipeReady(const std::string& user_name,
chromeos::AuthPolicyClient* client =
chromeos::DBusThreadManager::Get()->GetAuthPolicyClient();
client->AuthenticateUser(
- user_name, password_fd.get(),
+ username, password_fd.get(),
base::Bind(&GaiaScreenHandler::DoAdAuth, weak_factory_.GetWeakPtr(),
- user_name, key));
+ username, key));
}
void GaiaScreenHandler::HandleCompleteAuthentication(

Powered by Google App Engine
This is Rietveld 408576698