OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 void ExistingUserController::UpdateLoginDisplay(const UserList& users) { | 175 void ExistingUserController::UpdateLoginDisplay(const UserList& users) { |
176 bool show_users_on_signin; | 176 bool show_users_on_signin; |
177 UserList filtered_users; | 177 UserList filtered_users; |
178 | 178 |
179 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 179 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
180 &show_users_on_signin); | 180 &show_users_on_signin); |
181 if (show_users_on_signin) { | 181 if (show_users_on_signin) { |
182 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 182 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
183 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 183 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
184 if (LoginUtils::IsWhitelisted((*it)->email()) || | 184 bool meets_locally_managed_requirements = |
185 (*it)->GetType() != User::USER_TYPE_REGULAR) { | 185 (*it)->GetType() != User::USER_TYPE_LOCALLY_MANAGED || |
| 186 UserManager::Get()->AreLocallyManagedUsersAllowed(); |
| 187 bool meets_whitelist_requirements = |
| 188 LoginUtils::IsWhitelisted((*it)->email()) || |
| 189 (*it)->GetType() != User::USER_TYPE_REGULAR; |
| 190 if (meets_locally_managed_requirements && meets_whitelist_requirements) { |
186 filtered_users.push_back(*it); | 191 filtered_users.push_back(*it); |
187 } | 192 } |
188 } | 193 } |
189 } | 194 } |
190 | 195 |
191 // If no user pods are visible, fallback to single new user pod which will | 196 // If no user pods are visible, fallback to single new user pod which will |
192 // have guest session link. | 197 // have guest session link. |
193 bool show_guest; | 198 bool show_guest; |
194 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); | 199 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &show_guest); |
195 bool show_users; | 200 bool show_users; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (login_performer_delegate_.get()) | 436 if (login_performer_delegate_.get()) |
432 delegate = login_performer_delegate_.get(); | 437 delegate = login_performer_delegate_.get(); |
433 // Only one instance of LoginPerformer should exist at a time. | 438 // Only one instance of LoginPerformer should exist at a time. |
434 login_performer_.reset(NULL); | 439 login_performer_.reset(NULL); |
435 login_performer_.reset(new LoginPerformer(delegate)); | 440 login_performer_.reset(new LoginPerformer(delegate)); |
436 } | 441 } |
437 | 442 |
438 is_login_in_progress_ = true; | 443 is_login_in_progress_ = true; |
439 if (gaia::ExtractDomainName(user_context.username) == | 444 if (gaia::ExtractDomainName(user_context.username) == |
440 UserManager::kLocallyManagedUserDomain) { | 445 UserManager::kLocallyManagedUserDomain) { |
| 446 if (!UserManager::Get()->AreLocallyManagedUsersAllowed()) { |
| 447 LOG(ERROR) << "Login attempt of locally managed user detected."; |
| 448 login_display_->SetUIEnabled(true); |
| 449 return; |
| 450 } |
441 login_performer_->LoginAsLocallyManagedUser( | 451 login_performer_->LoginAsLocallyManagedUser( |
442 UserContext(user_context.username, | 452 UserContext(user_context.username, |
443 user_context.password, | 453 user_context.password, |
444 std::string())); // auth_code | 454 std::string())); // auth_code |
445 } else { | 455 } else { |
446 login_performer_->PerformLogin(user_context, auth_mode); | 456 login_performer_->PerformLogin(user_context, auth_mode); |
447 } | 457 } |
448 AccessibilityManager::Get()->MaybeSpeak( | 458 AccessibilityManager::Get()->MaybeSpeak( |
449 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 459 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
450 } | 460 } |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 // changed. | 1166 // changed. |
1157 UserManager::Get()->SaveUserOAuthStatus( | 1167 UserManager::Get()->SaveUserOAuthStatus( |
1158 username, | 1168 username, |
1159 User::OAUTH2_TOKEN_STATUS_INVALID); | 1169 User::OAUTH2_TOKEN_STATUS_INVALID); |
1160 | 1170 |
1161 login_display_->SetUIEnabled(true); | 1171 login_display_->SetUIEnabled(true); |
1162 login_display_->ShowGaiaPasswordChanged(username); | 1172 login_display_->ShowGaiaPasswordChanged(username); |
1163 } | 1173 } |
1164 | 1174 |
1165 } // namespace chromeos | 1175 } // namespace chromeos |
OLD | NEW |