You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

54 lines
1.7 KiB

using System;
using System.Data;
using System.Web;
using System.Web.Security;
using FineUI;
using System.Text;
using System.Linq;
using CK.SCP.Models.AppBoxEntity;
using System.Collections.Generic;
using CK.SCP.Models.ScpEntity;
using CK.SCP.Controller;
using System.Text.RegularExpressions;
using CK.SCP.Models;
using CK.SCP.Utils;
using CK.SCP.Common;
using System.Configuration;
using SCP.Code;
namespace SCP
{
public partial class Change_password : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string username = Request.QueryString["username"];
User user = DB.Users.Where(u => u.Name == username).FirstOrDefault();
String pattern = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
if (!string.IsNullOrEmpty(this.textPassword1.Value))
{
if (this.textPassword1.Value.Trim() != textConfim.Value.Trim())
{
Alert.Show(GetResourceKey("新密码与确认密码不一致!"));
return;
}
else
{
if (!Regex.IsMatch(this.textPassword1.Value.Trim(), pattern))
{
Alert.Show(GetResourceKey("新密码必须包含大小写字母,特殊符号~!@#$%^&*_中的一个和数字且不能少于8位!"));
return;
}
}
user.Password = PasswordUtil.CreateDbPassword(this.textPassword1.Value);
DB.SaveChanges();
}
}
}
}