?? userchangeps.cpp
字號:
// UserChangePs.cpp : implementation file
//
#include "stdafx.h"
#include "ClassSystem.h"
#include "UserChangePs.h"
#include "UserNode.h"
#include "UserList.h"
extern CUserNode curUser;
extern CUserList userlist;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserChangePs dialog
CUserChangePs::CUserChangePs(CWnd* pParent /*=NULL*/)
: CDialog(CUserChangePs::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserChangePs)
m_oldPassword = _T("");
m_newPassword1 = _T("");
m_newPassword2 = _T("");
//}}AFX_DATA_INIT
}
void CUserChangePs::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserChangePs)
DDX_Text(pDX, IDC_EDIT_OLD_PS, m_oldPassword);
DDX_Text(pDX, IDC_EDIT_NEW_PS2, m_newPassword1);
DDX_Text(pDX, IDC_EDIT_NEW_PS1, m_newPassword2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserChangePs, CDialog)
//{{AFX_MSG_MAP(CUserChangePs)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserChangePs message handlers
void CUserChangePs::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if(m_oldPassword == "")
{
MessageBox("請輸入原密碼!");
return ;
}
if(m_newPassword1 == "")
{
MessageBox("請確認新密碼!");
return ;
}
if(m_newPassword2=="")
{
MessageBox("請輸入新密碼!");
return ;
}
if(m_newPassword2 != m_newPassword1)
{
MessageBox("兩次輸入的密碼不一致!");
return ;
}
if(m_oldPassword != curUser.m_password)
{
MessageBox("原密碼不正確!");
return ;
}
curUser.m_password = m_newPassword2;
if(userlist.modifyPs(curUser.m_key,curUser))
{
MessageBox("密碼修改成功,下次登陸請用新密碼");
}
else
{
MessageBox("發生未知錯誤,密碼修改不成功!");
}
CDialog::OnOK();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -