-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetNewPasswordDlg.cpp
More file actions
68 lines (52 loc) · 1.49 KB
/
Copy pathSetNewPasswordDlg.cpp
File metadata and controls
68 lines (52 loc) · 1.49 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
68
// SetNewPasswordDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "ChatRoomClient.h"
#include "SetNewPasswordDlg.h"
#include "afxdialogex.h"
#include "RegisterDlg.h"
// SetNewPasswordDlg 对话框
IMPLEMENT_DYNAMIC(SetNewPasswordDlg, CDialogEx)
SetNewPasswordDlg::SetNewPasswordDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_SETNEWPSW_Dlg, pParent)
, newPassword(_T(""))
{
userName = _T("");
}
SetNewPasswordDlg::~SetNewPasswordDlg()
{
}
void SetNewPasswordDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, newPassword);
DDV_MaxChars(pDX, newPassword, 20);
}
BEGIN_MESSAGE_MAP(SetNewPasswordDlg, CDialogEx)
ON_BN_CLICKED(IDCANCEL, &SetNewPasswordDlg::OnBnClickedCancel)
ON_BN_CLICKED(IDOK, &SetNewPasswordDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// SetNewPasswordDlg 消息处理程序
void SetNewPasswordDlg::OnBnClickedCancel()
{
// TODO: 在此添加控件通知处理程序代码
CDialogEx::OnCancel();
}
void SetNewPasswordDlg::OnBnClickedOk()
{
UpdateData();
Message setMsg;
memset(&setMsg, 0, sizeof(Message));
setMsg.type = MSG_FINDPSW;
setMsg.data.findpswMsg.userName,
setMsg.data.findpswMsg.if_success = 2;
//对密码进行Md5加密
CONST BYTE* temppsw = (CONST BYTE*)newPassword.GetBuffer(40);
CString md5Password;
DWORD err;
GetMd5Hash(temppsw, 40, md5Password, err);
strcpy_s(setMsg.data.loginMsg.password, 40, md5Password);
strcpy_s(setMsg.data.findpswMsg.userName, 20, userName);
theApp.chatSocket->Send(&setMsg, sizeof(Message));
CDialogEx::OnOK();
}