AgentManager/DLG_Passwd.cpp
2025-01-22 15:45:17 +08:00

103 lines
2.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// DLG_Passwd.cpp : implementation file
//
#include "stdafx.h"
#include "smsmanager.h"
#include "DLG_Passwd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DLG_Passwd dialog
DLG_Passwd::DLG_Passwd(CWnd* pParent /*=NULL*/)
: CDialog(DLG_Passwd::IDD, pParent)
{
//{{AFX_DATA_INIT(DLG_Passwd)
m_strNew = _T("");
m_strNewRe = _T("");
m_strUser = _T("");
m_strYmm = _T("");
//}}AFX_DATA_INIT
memset( &m_Setup , 0 , sizeof(m_Setup) );
}
void DLG_Passwd::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DLG_Passwd)
DDX_Text(pDX, IDC_PASSWD_NEW, m_strNew);
DDV_MaxChars(pDX, m_strNew, 16);
DDX_Text(pDX, IDC_PASSWD_NEWRE, m_strNewRe);
DDV_MaxChars(pDX, m_strNewRe, 16);
DDX_Text(pDX, IDC_PASSWD_USER, m_strUser);
DDV_MaxChars(pDX, m_strUser, 16);
DDX_Text(pDX, IDC_PASSWD_YMM, m_strYmm);
DDV_MaxChars(pDX, m_strYmm, 16);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DLG_Passwd, CDialog)
//{{AFX_MSG_MAP(DLG_Passwd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLG_Passwd message handlers
void DLG_Passwd::OnOK()
{
UpdateData(true);
if ( m_strYmm != CString(m_Setup.szPasswd) )
{
MessageBox( _T("原密码输入不正确,请重输!") , _T("错误") , MB_ICONWARNING );
GetDlgItem(IDC_PASSWD_YMM)->SetFocus();
return ;
}
if ( m_strNew.GetLength() < 8 )
{
MessageBox( _T("密码要求至少8位请修改!") , _T("错误") , MB_ICONWARNING );
GetDlgItem(IDC_PASSWD_NEW)->SetFocus();
return ;
}
if ( m_strNew != m_strNewRe )
{
MessageBox( _T("两次输入的密码不相同,请重输!") , _T("错误") , MB_ICONWARNING );
GetDlgItem(IDC_PASSWD_NEW)->SetFocus();
return ;
}
_tcscpy( m_Setup.szPasswd , m_strNew );
CDialog::OnOK();
}
void DLG_Passwd::SetParam(SM_Setup setup)
{
m_Setup = setup;
}
SM_Setup DLG_Passwd::GetParam()
{
return m_Setup;
}
BOOL DLG_Passwd::OnInitDialog()
{
CDialog::OnInitDialog();
m_strUser = m_Setup.szUser;
UpdateData( false );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}