基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
/******************************
|
||||
* 说明:强制修改密码
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-12
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本: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 DevExpress.XtraEditors;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Lskj.Main
|
||||
{
|
||||
/// <summary>
|
||||
/// 强制修改密码
|
||||
/// </summary>
|
||||
public partial class FrmPassword : BaseForm
|
||||
{
|
||||
public string UserId;
|
||||
public string UserName;
|
||||
Regex regex = new Regex(@"(?=.*[0-9]) #必须包含数字
|
||||
(?=.*[a-zA-Z]) #必须包含小写或大写字母
|
||||
(?=.*[^a-zA-Z0-9]) #必须包含符号
|
||||
.{8,18} #至少8个字符,最多18个字符
|
||||
", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
public FrmPassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:界面加载时</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </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 FrmPassword_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.txtUserName.Text = UserName;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:修改保存</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </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 pass_before = txtPassBefore.Text.Trim();
|
||||
string pass_after = txtPassAfter.Text.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pass_before) || string.IsNullOrWhiteSpace(pass_after))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.PasswordNotNull);
|
||||
return;
|
||||
}
|
||||
if (!pass_before.Equals(pass_after))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.PasswordInconformity);
|
||||
return;
|
||||
}
|
||||
// 验证密码标准
|
||||
if (SystemInfo.Instance.VerfyPasswordStrength ? !regex.IsMatch(pass_after) : false)
|
||||
{
|
||||
MessageUtil.Show("密码不符合要求!");
|
||||
return;
|
||||
}
|
||||
|
||||
int result = MainImpl.ForceUpdatePassword(UserId, pass_after);
|
||||
switch (result)
|
||||
{
|
||||
case 0: // 用户不存在
|
||||
MessageUtil.Show(ResourceKeys.UserNotFound);
|
||||
break;
|
||||
case 1:
|
||||
MessageUtil.Show(ResourceKeys.PasswordUpdateSuccess);
|
||||
ERPInfo.Instance.Password = SHAHelper.EncryptPassword(pass_after);
|
||||
this.DialogResult = DialogResult.OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show("修改密码出错!" + Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:取消修改</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-12 </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