123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- // Psw.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "Psw.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // Psw dialog
- Psw::Psw(CWnd* pParent /*=NULL*/): CDialog(Psw::IDD, pParent)
- {
- m_account = _T("");
- m_psw = _T("");
- m_psw2 = _T("");
- m_psw3 = _T("");
- }
- void Psw::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(Psw)
- DDX_Text(pDX, IDC_EDITaccount, m_account);
- DDX_Text(pDX, IDC_EDITpsw, m_psw);
- DDX_Text(pDX, IDC_EDITpsw2, m_psw2);
- DDX_Text(pDX, IDC_EDITpsw3, m_psw3);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(Psw, CDialog)
- //{{AFX_MSG_MAP(Psw)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- void Psw::OnOK()
- {
- UpdateData();
- BYTE byPsw[50] = {0};
- #ifndef UNICODE
- memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength());
- #endif
- CMD5 md5;
- md5.SetBYTEText(byPsw, strlen((char*)byPsw));
- CString strMD5 = md5.GetMD5Digest();
- if (strMD5 != m_List1array.ElementAt(0).ElementAt(2))
- {
- AfxMessageBox("旧密码错误!", MB_ICONINFORMATION);
- return;
- }
- if (m_psw3 != m_psw2)
- {
- AfxMessageBox("新密码不一至!", MB_ICONINFORMATION);
- return;
- }
- CString sql;
- #ifndef UNICODE
- memset(byPsw, 0 , 50);
- memcpy(byPsw, (LPCSTR)m_psw3, m_psw3.GetLength());
- md5.SetBYTEText(byPsw, strlen((char*)byPsw));
- #endif
- strMD5 = md5.GetMD5Digest();
- sql = "update [user] set [psw]='" + strMD5 + "' where [account]='" + m_account + "'";
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- CDialog::OnOK();
- }
- BOOL Psw::OnInitDialog()
- {
- CDialog::OnInitDialog();
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 23;
- g_sendhead.tabcount = 1;
- CString sql;
- sql = "name='" + g_user.name + "'";
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return 1;
- DataToArray(&m_List1array);
- if (m_List1array.GetSize() == 0)
- {
- CDialog::OnCancel();
- return true;
- }
- m_account = m_List1array.ElementAt(0).ElementAt(0);
- UpdateData(false);
- this->CenterWindow(g_pMainWnd);
- return TRUE;
- }
|