mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Rename CheckUserName() to CheckAccountName() and move it to a new source file (misc.c).
- Also use CheckAccountName() to check group names for illegal characters. svn path=/trunk/; revision=33579
This commit is contained in:
parent
e5495f7f62
commit
653089313c
5 changed files with 55 additions and 32 deletions
|
@ -122,6 +122,12 @@ NewGroupDlgProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case IDOK:
|
||||
if (!CheckAccountName(hwndDlg, IDC_GROUP_NEW_NAME, NULL))
|
||||
{
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_GROUP_NEW_NAME));
|
||||
SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETSEL, 0, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);
|
||||
if (nLength > 0)
|
||||
|
@ -338,6 +344,9 @@ OnEndLabelEdit(LPNMLVDISPINFO pnmv)
|
|||
if (lstrcmp(szOldGroupName, szNewGroupName) == 0)
|
||||
return FALSE;
|
||||
|
||||
/* Check the group name for illegal characters */
|
||||
if (!CheckAccountName(NULL, 0, szNewGroupName))
|
||||
return FALSE;
|
||||
|
||||
/* Change the user name */
|
||||
lgrpi0.lgrpi0_name = szNewGroupName;
|
||||
|
|
38
reactos/dll/cpl/usrmgr/misc.c
Normal file
38
reactos/dll/cpl/usrmgr/misc.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User Manager Control Panel
|
||||
* FILE: dll/cpl/usrmgr/misc.c
|
||||
* PURPOSE: Miscellaneus functions
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "usrmgr.h"
|
||||
|
||||
|
||||
BOOL
|
||||
CheckAccountName(HWND hwndDlg,
|
||||
INT nIdDlgItem,
|
||||
LPTSTR lpAccountName)
|
||||
{
|
||||
TCHAR szAccountName[256];
|
||||
UINT uLen;
|
||||
|
||||
if (lpAccountName)
|
||||
uLen = _tcslen(lpAccountName);
|
||||
else
|
||||
uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szAccountName, 256);
|
||||
|
||||
/* Check the account name */
|
||||
if (uLen > 0 &&
|
||||
_tcspbrk((lpAccountName) ? lpAccountName : szAccountName, TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
|
||||
{
|
||||
MessageBox(hwndDlg,
|
||||
TEXT("The account name you entered is invalid! An account name must not contain the following charecters: *+,/:;<=>?[\\]|"),
|
||||
TEXT("ERROR"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -56,36 +56,6 @@ CheckPasswords(HWND hwndDlg,
|
|||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
CheckUserName(HWND hwndDlg,
|
||||
INT nIdDlgItem,
|
||||
LPTSTR lpUserName)
|
||||
{
|
||||
TCHAR szUserName[256];
|
||||
UINT uLen;
|
||||
|
||||
if (lpUserName)
|
||||
uLen = _tcslen(lpUserName);
|
||||
else
|
||||
uLen = GetDlgItemText(hwndDlg, nIdDlgItem, szUserName, 256);
|
||||
|
||||
/* Check the user name */
|
||||
if (uLen > 0 &&
|
||||
_tcspbrk((lpUserName) ? lpUserName : szUserName, TEXT("\"*+,/\\:;<=>?[]|")) != NULL)
|
||||
{
|
||||
MessageBox(hwndDlg,
|
||||
TEXT("The user name you entered is invalid! A user name must not contain the following charecters: *+,/:;<=>?[\\]|"),
|
||||
TEXT("ERROR"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
INT_PTR CALLBACK
|
||||
ChangePasswordDlgProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
|
@ -204,7 +174,7 @@ NewUserDlgProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case IDOK:
|
||||
if (!CheckUserName(hwndDlg, IDC_USER_NEW_NAME, NULL))
|
||||
if (!CheckAccountName(hwndDlg, IDC_USER_NEW_NAME, NULL))
|
||||
{
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_USER_NEW_NAME));
|
||||
SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, EM_SETSEL, 0, -1);
|
||||
|
@ -554,7 +524,7 @@ OnEndLabelEdit(LPNMLVDISPINFO pnmv)
|
|||
return FALSE;
|
||||
|
||||
/* Check the user name for illegal characters */
|
||||
if (!CheckUserName(NULL, 0, szNewUserName))
|
||||
if (!CheckAccountName(NULL, 0, szNewUserName))
|
||||
return FALSE;
|
||||
|
||||
/* Change the user name */
|
||||
|
|
|
@ -29,6 +29,11 @@ INT_PTR CALLBACK UsersPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
INT_PTR CALLBACK GroupsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* misc.c */
|
||||
BOOL
|
||||
CheckAccountName(HWND hwndDlg,
|
||||
INT nIdDlgItem,
|
||||
LPTSTR lpAccountName);
|
||||
|
||||
#endif /* __CPL_DESK_H__ */
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<library>msvcrt</library>
|
||||
<file>extra.c</file>
|
||||
<file>groups.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>users.c</file>
|
||||
<file>usrmgr.c</file>
|
||||
<file>usrmgr.rc</file>
|
||||
|
|
Loading…
Reference in a new issue