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

Unified Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 2552473002: Display error message when user try to open a locked supervised user profile when force-sign-in is … (Closed)
Patch Set: sky's comments Created 4 years 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
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
index 22351cfc465d5502a82e3a371a188675607530af..5cae011a7df6d1817e1470780ae8e5f86f62a68f 100644
--- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
+++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -43,6 +43,8 @@
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/user_manager.h"
#include "chrome/browser/ui/webui/profile_helper.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -462,11 +464,22 @@ void UserManagerScreenHandler::HandleAuthenticatedLaunchUser(
if (!email_address_.empty()) {
// In order to support the upgrade case where we have a local hash but no
// password token, the user must perform a full online reauth.
- UserManager::ShowReauthDialog(browser_context, email_address_,
- signin_metrics::Reason::REASON_UNLOCK);
+ UserManagerProfileDialog::ShowReauthDialog(
+ browser_context, email_address_, signin_metrics::Reason::REASON_UNLOCK);
+ } else if (entry->IsSigninRequired() && entry->IsSupervised()) {
+ // Supervised profile will only be locked when force-sign-in is enabled
+ // and it shouldn't be unlocked. Display the error message directly via
+ // the system profile to avoid profile creation.
+ LoginUIServiceFactory::GetForProfile(
+ Profile::FromWebUI(web_ui())->GetOriginalProfile())
+ ->DisplayLoginResult(nullptr,
+ l10n_util::GetStringUTF16(
+ IDS_SUPERVISED_USER_NOT_ALLOWED_BY_POLICY),
+ base::string16());
+ UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage(browser_context);
} else {
// Fresh sign in via user manager without existing email address.
- UserManager::ShowSigninDialog(browser_context, profile_path);
+ UserManagerProfileDialog::ShowSigninDialog(browser_context, profile_path);
}
}
@@ -691,9 +704,9 @@ void UserManagerScreenHandler::OnOAuthError() {
// Password has changed. Go through online signin flow.
DCHECK(!email_address_.empty());
oauth_client_.reset();
- UserManager::ShowReauthDialog(web_ui()->GetWebContents()->GetBrowserContext(),
- email_address_,
- signin_metrics::Reason::REASON_UNLOCK);
+ UserManagerProfileDialog::ShowReauthDialog(
+ web_ui()->GetWebContents()->GetBrowserContext(), email_address_,
+ signin_metrics::Reason::REASON_UNLOCK);
}
void UserManagerScreenHandler::OnNetworkError(int response_code) {
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698