基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
/******************************
|
||||
* 说明:修改密码
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-14
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using Lskj.Business;
|
||||
using Lskj.Model;
|
||||
using Lskj.Main2.Model;
|
||||
using Lskj.Business.Impl;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Lskj.Main2
|
||||
{
|
||||
/// <summary>
|
||||
/// 修改密码
|
||||
/// </summary>
|
||||
public partial class FrmUpdatePassword : BaseForm
|
||||
{
|
||||
Regex regex = new Regex(@"(?=.*[0-9]) #必须包含数字
|
||||
(?=.*[a-zA-Z]) #必须包含小写或大写字母
|
||||
(?=.*[^a-zA-Z0-9]) #必须包含符号
|
||||
.{8,18} #至少6个字符,最多18个字符
|
||||
", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
public FrmUpdatePassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:修改密码</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-15 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string beforePass = txtOldPass.Text.Trim();
|
||||
string afterPass = txtNewPass.Text.Trim();
|
||||
string comfirmPass = txtPassConfirm.Text.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(afterPass))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.NewPasswordNotNull);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(comfirmPass))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ComfirmPasswordNotNull);
|
||||
return;
|
||||
}
|
||||
if (!afterPass.Equals(comfirmPass))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.PasswordInconformity);
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证密码标准
|
||||
if (SystemInfo.Instance.VerfyPasswordStrength ? !regex.IsMatch(comfirmPass) : false)
|
||||
{
|
||||
MessageUtil.Show("密码不符合要求!");
|
||||
return;
|
||||
}
|
||||
|
||||
int result = MainImpl.UpdatePassword(ERPInfo.Instance.UserId, beforePass, afterPass);
|
||||
switch (result)
|
||||
{
|
||||
case 0: // 用户不存在
|
||||
MessageUtil.Show(ResourceKeys.UserNotFound);
|
||||
break;
|
||||
case 1: // 修改成功
|
||||
MessageUtil.Show(ResourceKeys.PasswordUpdateSuccess);
|
||||
Manager.StartForm();
|
||||
break;
|
||||
case 2: // 旧密码不正确.
|
||||
MessageUtil.Show(ResourceKeys.OldPasswordFault);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteError("修改密码出错!", ex);
|
||||
MessageUtil.Show("修改密码出错!" + ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:退出修改</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-15 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user