From 5888821aa442d07b8f0627a2365ea94bb5bae2c0 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 19 Apr 2014 09:09:12 +0000 Subject: [PATCH] [MSGINA] - Allways add the computer name to the domain list. - Notify the user about required password changes and repeat the logon using the new password. svn path=/trunk/; revision=62793 --- reactos/dll/win32/msgina/gui.c | 72 +++++++++++++++++++++++++- reactos/dll/win32/msgina/lang/bg-BG.rc | 2 + reactos/dll/win32/msgina/lang/cs-CZ.rc | 2 + reactos/dll/win32/msgina/lang/de-DE.rc | 2 + reactos/dll/win32/msgina/lang/en-US.rc | 2 + reactos/dll/win32/msgina/lang/es-ES.rc | 2 + reactos/dll/win32/msgina/lang/fr-FR.rc | 2 + reactos/dll/win32/msgina/lang/he-IL.rc | 2 + reactos/dll/win32/msgina/lang/id-ID.rc | 2 + reactos/dll/win32/msgina/lang/it-IT.rc | 2 + reactos/dll/win32/msgina/lang/ja-JP.rc | 2 + reactos/dll/win32/msgina/lang/no-NO.rc | 2 + reactos/dll/win32/msgina/lang/pl-PL.rc | 2 + reactos/dll/win32/msgina/lang/ro-RO.rc | 2 + reactos/dll/win32/msgina/lang/ru-RU.rc | 2 + reactos/dll/win32/msgina/lang/sk-SK.rc | 2 + reactos/dll/win32/msgina/lang/sq-AL.rc | 2 + reactos/dll/win32/msgina/lang/tr-TR.rc | 2 + reactos/dll/win32/msgina/lang/uk-UA.rc | 2 + reactos/dll/win32/msgina/resource.h | 2 + 20 files changed, 108 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/msgina/gui.c b/reactos/dll/win32/msgina/gui.c index 1bd863ea108..41b7689f470 100644 --- a/reactos/dll/win32/msgina/gui.c +++ b/reactos/dll/win32/msgina/gui.c @@ -975,6 +975,38 @@ TRACE("Account locked!\n"); MB_OK | MB_ICONERROR); goto done; } + else if ((SubStatus == STATUS_PASSWORD_MUST_CHANGE) || + (SubStatus == STATUS_PASSWORD_EXPIRED)) + { + if (SubStatus == STATUS_PASSWORD_MUST_CHANGE) + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONSTOP, + IDS_LOGONTITLE, + IDS_PASSWORDMUSTCHANGE); + else + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONSTOP, + IDS_LOGONTITLE, + IDS_PASSWORDEXPIRED); + + if (!OnChangePassword(hwndDlg, + pgContext)) + goto done; + + Status = DoLoginTasks(pgContext, + pgContext->UserName, + pgContext->Domain, + pgContext->Password, + &SubStatus); + if (!NT_SUCCESS(Status)) + { + TRACE("Login after password change failed! (Status 0x%08lx)\n", Status); + + goto done; + } + } else { TRACE("Other error!\n"); @@ -1018,6 +1050,43 @@ done: return result; } + +static +VOID +SetDomainComboBox( + HWND hwndDomainComboBox, + PGINA_CONTEXT pgContext) +{ + WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD dwComputerNameLength; + LONG lIndex = 0; + LONG lFindIndex; + + SendMessageW(hwndDomainComboBox, CB_RESETCONTENT, 0, 0); + + dwComputerNameLength = sizeof(szComputerName) / sizeof(WCHAR); + if (GetComputerNameW(szComputerName, &dwComputerNameLength)) + { + lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)szComputerName); + } + + if (wcslen(pgContext->Domain) != 0) + { + lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pgContext->Domain); + if (lFindIndex == CB_ERR) + { + lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)pgContext->Domain); + } + else + { + lIndex = lFindIndex; + } + } + + SendMessageW(hwndDomainComboBox, CB_SETCURSEL, lIndex, 0); +} + + static INT_PTR CALLBACK LoggedOutWindowProc( IN HWND hwndDlg, @@ -1045,8 +1114,7 @@ LoggedOutWindowProc( if (pgContext->bShutdownWithoutLogon == FALSE) EnableWindow(GetDlgItem(hwndDlg, IDC_SHUTDOWN), FALSE); - SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_ADDSTRING, 0, (LPARAM)pgContext->Domain); - SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_SETCURSEL, 0, 0); + SetDomainComboBox(GetDlgItem(hwndDlg, IDC_LOGON_TO), pgContext); SetFocus(GetDlgItem(hwndDlg, pgContext->bDontDisplayLastUserName ? IDC_USERNAME : IDC_PASSWORD)); diff --git a/reactos/dll/win32/msgina/lang/bg-BG.rc b/reactos/dll/win32/msgina/lang/bg-BG.rc index c6e41603d98..cee7c055f8e 100644 --- a/reactos/dll/win32/msgina/lang/bg-BG.rc +++ b/reactos/dll/win32/msgina/lang/bg-BG.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/cs-CZ.rc b/reactos/dll/win32/msgina/lang/cs-CZ.rc index fb7c834e92c..05c71e7f97c 100644 --- a/reactos/dll/win32/msgina/lang/cs-CZ.rc +++ b/reactos/dll/win32/msgina/lang/cs-CZ.rc @@ -153,6 +153,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/de-DE.rc b/reactos/dll/win32/msgina/lang/de-DE.rc index 612afcf8a6e..e71838cc2be 100644 --- a/reactos/dll/win32/msgina/lang/de-DE.rc +++ b/reactos/dll/win32/msgina/lang/de-DE.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Anmeldemeldung" IDS_LOGONWRONGUSERORPWD "Sie konnten nicht angemeldet werden. Prüfen Sie Benutzername und Domäne, und geben Sie das Passwort erneut ein. Bei Passworten wird Groß- und Kleinschreibung unterschieden." IDS_LOGONUSERDISABLED "Ihr Konto wurde deaktiviert. Wenden Sie sich an Ihren Systemadministrator." + IDS_PASSWORDMUSTCHANGE "Sie müssen Ihr Paasswort bei der ersten Anmeldung ändern." + IDS_PASSWORDEXPIRED "Ihr Passwort ist abgelaufen und muss geändert werden." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/en-US.rc b/reactos/dll/win32/msgina/lang/en-US.rc index b699b34c2b6..c8828ca2313 100644 --- a/reactos/dll/win32/msgina/lang/en-US.rc +++ b/reactos/dll/win32/msgina/lang/en-US.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/es-ES.rc b/reactos/dll/win32/msgina/lang/es-ES.rc index 83c9cb9981f..45a0f3dd9eb 100644 --- a/reactos/dll/win32/msgina/lang/es-ES.rc +++ b/reactos/dll/win32/msgina/lang/es-ES.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/fr-FR.rc b/reactos/dll/win32/msgina/lang/fr-FR.rc index 60b838c355d..4f0d3242a07 100644 --- a/reactos/dll/win32/msgina/lang/fr-FR.rc +++ b/reactos/dll/win32/msgina/lang/fr-FR.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/he-IL.rc b/reactos/dll/win32/msgina/lang/he-IL.rc index 89be4d60945..bb76396143e 100644 --- a/reactos/dll/win32/msgina/lang/he-IL.rc +++ b/reactos/dll/win32/msgina/lang/he-IL.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/id-ID.rc b/reactos/dll/win32/msgina/lang/id-ID.rc index 4e45a682551..6e33eb6a7fe 100644 --- a/reactos/dll/win32/msgina/lang/id-ID.rc +++ b/reactos/dll/win32/msgina/lang/id-ID.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/it-IT.rc b/reactos/dll/win32/msgina/lang/it-IT.rc index a1e442e1024..eef95f8767f 100644 --- a/reactos/dll/win32/msgina/lang/it-IT.rc +++ b/reactos/dll/win32/msgina/lang/it-IT.rc @@ -156,6 +156,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ja-JP.rc b/reactos/dll/win32/msgina/lang/ja-JP.rc index b3af12c5549..118f1b10ce8 100644 --- a/reactos/dll/win32/msgina/lang/ja-JP.rc +++ b/reactos/dll/win32/msgina/lang/ja-JP.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/no-NO.rc b/reactos/dll/win32/msgina/lang/no-NO.rc index bce3ee2d0c3..062cc610a9b 100644 --- a/reactos/dll/win32/msgina/lang/no-NO.rc +++ b/reactos/dll/win32/msgina/lang/no-NO.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/pl-PL.rc b/reactos/dll/win32/msgina/lang/pl-PL.rc index a1d56bec798..80c2020e19b 100644 --- a/reactos/dll/win32/msgina/lang/pl-PL.rc +++ b/reactos/dll/win32/msgina/lang/pl-PL.rc @@ -157,6 +157,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ro-RO.rc b/reactos/dll/win32/msgina/lang/ro-RO.rc index 4e517e63095..853a394f80a 100644 --- a/reactos/dll/win32/msgina/lang/ro-RO.rc +++ b/reactos/dll/win32/msgina/lang/ro-RO.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Mesaj de autentificare" IDS_LOGONWRONGUSERORPWD "Sistemul nu vă poate autentifica. Asigurați-vă că numele și domeniul sunt corecte apoi tastați din nou parola. În parolă se face distincție între majuscule și minuscule." IDS_LOGONUSERDISABLED "Contul dumneavoastră a fost dezactivat. Contactați administratorul de sistem." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/ru-RU.rc b/reactos/dll/win32/msgina/lang/ru-RU.rc index 1061218abb7..dc7cea38602 100644 --- a/reactos/dll/win32/msgina/lang/ru-RU.rc +++ b/reactos/dll/win32/msgina/lang/ru-RU.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "Системе не удается войти в. Убедитесь в том, ваше имя пользователя и домен верны, то введите пароль еще раз. Символы в Пароли вводятся с учетом регистра" IDS_LOGONUSERDISABLED "Ваш аккаунт был отключен. Пожалуйста, обратитесь к системному администратору." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/sk-SK.rc b/reactos/dll/win32/msgina/lang/sk-SK.rc index 31d4ab2418f..3b624ab09a1 100644 --- a/reactos/dll/win32/msgina/lang/sk-SK.rc +++ b/reactos/dll/win32/msgina/lang/sk-SK.rc @@ -153,6 +153,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/sq-AL.rc b/reactos/dll/win32/msgina/lang/sq-AL.rc index cb9a93fb962..17257a22837 100644 --- a/reactos/dll/win32/msgina/lang/sq-AL.rc +++ b/reactos/dll/win32/msgina/lang/sq-AL.rc @@ -151,6 +151,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/tr-TR.rc b/reactos/dll/win32/msgina/lang/tr-TR.rc index c216ef7b5f6..b6e731a5353 100644 --- a/reactos/dll/win32/msgina/lang/tr-TR.rc +++ b/reactos/dll/win32/msgina/lang/tr-TR.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/lang/uk-UA.rc b/reactos/dll/win32/msgina/lang/uk-UA.rc index b125c5473c9..191b3053dd2 100644 --- a/reactos/dll/win32/msgina/lang/uk-UA.rc +++ b/reactos/dll/win32/msgina/lang/uk-UA.rc @@ -156,6 +156,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/reactos/dll/win32/msgina/resource.h b/reactos/dll/win32/msgina/resource.h index e310dcf9a07..cee14bea090 100644 --- a/reactos/dll/win32/msgina/resource.h +++ b/reactos/dll/win32/msgina/resource.h @@ -57,6 +57,8 @@ #define IDS_LOGONTITLE 40015 #define IDS_LOGONWRONGUSERORPWD 40016 #define IDS_LOGONUSERDISABLED 40017 +#define IDS_PASSWORDMUSTCHANGE 40018 +#define IDS_PASSWORDEXPIRED 40019 #define IDS_SHUTDOWN_SHUTDOWN 50000 #define IDS_SHUTDOWN_LOGOFF 50001