-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindPasswordDlg.cpp
More file actions
67 lines (52 loc) · 1.5 KB
/
Copy pathFindPasswordDlg.cpp
File metadata and controls
67 lines (52 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// FindPasswordDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "ChatRoomClient.h"
#include "FindPasswordDlg.h"
#include "afxdialogex.h"
#include "RegisterDlg.h"
// FindPasswordDlg 对话框
IMPLEMENT_DYNAMIC(FindPasswordDlg, CDialogEx)
FindPasswordDlg::FindPasswordDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_FINDPASSWORD_DLG, pParent)
, userName(_T(""))
, pswAnswer(_T(""))
{
}
FindPasswordDlg::~FindPasswordDlg()
{
}
void FindPasswordDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_FINDPSW_USERNAME, userName);
DDV_MaxChars(pDX, userName, 20);
DDX_Text(pDX, IDC_FINDPSW_PSWANSWER, pswAnswer);
DDV_MaxChars(pDX, pswAnswer, 20);
}
BEGIN_MESSAGE_MAP(FindPasswordDlg, CDialogEx)
ON_BN_CLICKED(IDOK, &FindPasswordDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &FindPasswordDlg::OnBnClickedCancel)
END_MESSAGE_MAP()
// FindPasswordDlg 消息处理程序
void FindPasswordDlg::OnBnClickedOk()
{
UpdateData();
Message findpswMsg;
memset(&findpswMsg, 0, sizeof(Message));
findpswMsg.type = MSG_FINDPSW;
strcpy_s(findpswMsg.data.findpswMsg.userName, 20, userName);
//对密保答案进行Md5加密
CONST BYTE* tempanswer = (CONST BYTE*)pswAnswer.GetBuffer(40);
CString md5Answer;
DWORD err;
GetMd5Hash(tempanswer, 40, md5Answer, err);
strcpy_s(findpswMsg.data.findpswMsg.answer, 40, md5Answer);
theApp.chatSocket->Send(&findpswMsg, sizeof(Message));
CDialogEx::OnOK();
}
void FindPasswordDlg::OnBnClickedCancel()
{
// TODO: 在此添加控件通知处理程序代码
CDialogEx::OnCancel();
}