Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.9 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: RestorePasswordPage.cpp
  4. //
  5. // Synopsis: Defines the restore password page used in the
  6. // Express path for the CYS Wizard
  7. //
  8. // History: 02/08/2001 JeffJon Created
  9. #include "pch.h"
  10. #include "resource.h"
  11. #include "InstallationUnitProvider.h"
  12. #include "RestorePasswordPage.h"
  13. #include "state.h"
  14. static PCWSTR RESTOREPWD_PAGE_HELP = L"cys.chm::/cys_configuring_first_server.htm";
  15. RestorePasswordPage::RestorePasswordPage()
  16. :
  17. CYSWizardPage(
  18. IDD_RESTORE_PASSWORD_PAGE,
  19. IDS_RESTORE_PASSWORD_TITLE,
  20. IDS_RESTORE_PASSWORD_SUBTITLE,
  21. RESTOREPWD_PAGE_HELP)
  22. {
  23. LOG_CTOR(RestorePasswordPage);
  24. }
  25. RestorePasswordPage::~RestorePasswordPage()
  26. {
  27. LOG_DTOR(RestorePasswordPage);
  28. }
  29. void
  30. RestorePasswordPage::OnInit()
  31. {
  32. LOG_FUNCTION(RestorePasswordPage::OnInit);
  33. // NTRAID#NTBUG9-202238-2000/11/07-sburns
  34. password.Init(Win::GetDlgItem(hwnd, IDC_PASSWORD));
  35. confirm.Init(Win::GetDlgItem(hwnd, IDC_CONFIRM));
  36. }
  37. bool
  38. RestorePasswordPage::OnSetActive()
  39. {
  40. LOG_FUNCTION(RestorePasswordPage::OnSetActive);
  41. Win::PropSheet_SetWizButtons(
  42. Win::GetParent(hwnd),
  43. PSWIZB_BACK | PSWIZB_NEXT);
  44. return true;
  45. }
  46. int
  47. RestorePasswordPage::Validate()
  48. {
  49. LOG_FUNCTION(RestorePasswordPage::Validate);
  50. int nextPage = -1;
  51. String password = Win::GetTrimmedDlgItemText(hwnd, IDC_PASSWORD);
  52. String confirm = Win::GetTrimmedDlgItemText(hwnd, IDC_CONFIRM);
  53. if (password != confirm)
  54. {
  55. String blank;
  56. Win::SetDlgItemText(hwnd, IDC_PASSWORD, blank);
  57. Win::SetDlgItemText(hwnd, IDC_CONFIRM, blank);
  58. popup.Gripe(
  59. hwnd,
  60. IDC_PASSWORD,
  61. IDS_PASSWORD_MISMATCH);
  62. return -1;
  63. }
  64. InstallationUnitProvider::GetInstance().GetADInstallationUnit().SetSafeModeAdminPassword(password);
  65. nextPage = IDD_EXPRESS_DNS_PAGE;
  66. return nextPage;
  67. }