summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-18 19:08:46 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-18 19:08:46 +0300
commit9b0c4669db9349a324b8f1913cdf38766dfc4ae2 (patch)
tree84f4b4221dbb6b775ee311d83b63cf19657ba535
parente52b46c90aef0379eb56562ab52205c0bc5b461a (diff)
fixes #4210 (Несколько учёток с одинаковыми именами)
-rw-r--r--src/mir_app/src/proto_opts.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index 0896f5013b..9304606d33 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -84,13 +84,25 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const ch
return pa;
}
-static bool FindAccountByName(const char *szModuleName)
+static bool FindAccountByModule(const char *pszModuleName)
{
- if (!mir_strlen(szModuleName))
+ if (!mir_strlen(pszModuleName))
return false;
for (auto &pa : g_arAccounts)
- if (_stricmp(szModuleName, pa->szModuleName) == 0)
+ if (_stricmp(pszModuleName, pa->szModuleName) == 0)
+ return true;
+
+ return false;
+}
+
+static bool FindAccountByName(const wchar_t *pwszUserName)
+{
+ if (!mir_wstrlen(pwszUserName))
+ return false;
+
+ for (auto &pa : g_arAccounts)
+ if (_wcsicmp(pwszUserName, pa->tszAccountName) == 0)
return true;
return false;
@@ -883,10 +895,15 @@ bool CAccountFormDlg::OnApply()
return false;
}
- if (FindAccountByName(_T2A(buf))) {
+ if (FindAccountByModule(_T2A(buf))) {
MessageBoxW(m_hwnd, TranslateT("Account internal name has to be unique. Please enter unique name."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
return false;
}
+
+ if (FindAccountByName(wszAccName)) {
+ MessageBoxW(m_hwnd, TranslateT("Account's name has to be unique. Please enter unique name."), TranslateT("Account error"), MB_ICONERROR | MB_OK);
+ return false;
+ }
}
if (m_action == PRAC_UPGRADED) {