|
@@ -23,17 +23,15 @@ public class ChangePass : MonoBehaviour
|
|
terror2.SetActive(false);
|
|
terror2.SetActive(false);
|
|
terror3.SetActive(false);
|
|
terror3.SetActive(false);
|
|
}
|
|
}
|
|
- public void changepass()
|
|
|
|
|
|
+
|
|
|
|
+ public static passcheck checkpass(string pass)
|
|
{
|
|
{
|
|
- terror.SetActive(false);
|
|
|
|
- terror2.SetActive(false);
|
|
|
|
- terror3.SetActive(false);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
int ct =0;
|
|
int ct =0;
|
|
string msg = "密码格式缺少:";
|
|
string msg = "密码格式缺少:";
|
|
var pwdRegex1 = "(?=.*[0-9])"; // 数字
|
|
var pwdRegex1 = "(?=.*[0-9])"; // 数字
|
|
Regex reg1 = new Regex(pwdRegex1);
|
|
Regex reg1 = new Regex(pwdRegex1);
|
|
- bool isMatch1 = reg1.IsMatch(inputnew1.text);
|
|
|
|
|
|
+ bool isMatch1 = reg1.IsMatch(pass);
|
|
if(!isMatch1)
|
|
if(!isMatch1)
|
|
{
|
|
{
|
|
msg += "数字 ";
|
|
msg += "数字 ";
|
|
@@ -44,7 +42,7 @@ public class ChangePass : MonoBehaviour
|
|
}
|
|
}
|
|
var pwdRegex2 = "(?=.*[a-z])"; // 小写字母
|
|
var pwdRegex2 = "(?=.*[a-z])"; // 小写字母
|
|
Regex reg2 = new Regex(pwdRegex2);
|
|
Regex reg2 = new Regex(pwdRegex2);
|
|
- bool isMatch2 = reg2.IsMatch(inputnew1.text);
|
|
|
|
|
|
+ bool isMatch2 = reg2.IsMatch(pass);
|
|
if(!isMatch2)
|
|
if(!isMatch2)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -56,7 +54,7 @@ public class ChangePass : MonoBehaviour
|
|
}
|
|
}
|
|
var pwdRegex3 = "(?=.*[A-Z])"; // 大写字母
|
|
var pwdRegex3 = "(?=.*[A-Z])"; // 大写字母
|
|
Regex reg3= new Regex(pwdRegex3);
|
|
Regex reg3= new Regex(pwdRegex3);
|
|
- bool isMatch3 = reg3.IsMatch(inputnew1.text);
|
|
|
|
|
|
+ bool isMatch3 = reg3.IsMatch(pass);
|
|
if(!isMatch3)
|
|
if(!isMatch3)
|
|
{
|
|
{
|
|
msg += "大写字母 ";
|
|
msg += "大写字母 ";
|
|
@@ -67,7 +65,7 @@ public class ChangePass : MonoBehaviour
|
|
}
|
|
}
|
|
var pwdRegex4 = "[!@#$%^&*(),.?\\\":{}|<>]"; // 特殊字符
|
|
var pwdRegex4 = "[!@#$%^&*(),.?\\\":{}|<>]"; // 特殊字符
|
|
Regex reg4= new Regex(pwdRegex4);
|
|
Regex reg4= new Regex(pwdRegex4);
|
|
- bool isMatch4 = reg4.IsMatch(inputnew1.text);
|
|
|
|
|
|
+ bool isMatch4 = reg4.IsMatch(pass);
|
|
if(!isMatch4)
|
|
if(!isMatch4)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -78,10 +76,27 @@ public class ChangePass : MonoBehaviour
|
|
ct++;
|
|
ct++;
|
|
}
|
|
}
|
|
msg+="中"+(3-ct)+"个";
|
|
msg+="中"+(3-ct)+"个";
|
|
- if(inputnew1.text.Length<8)
|
|
|
|
|
|
+ if(pass.Length<8)
|
|
{
|
|
{
|
|
msg = "密码必须大于8位";
|
|
msg = "密码必须大于8位";
|
|
}
|
|
}
|
|
|
|
+ passcheck p= new passcheck();
|
|
|
|
+ p.ct = ct;
|
|
|
|
+ p.msg=msg;
|
|
|
|
+ return p;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public class passcheck
|
|
|
|
+ {
|
|
|
|
+ public int ct;
|
|
|
|
+ public string msg;
|
|
|
|
+ }
|
|
|
|
+ public void changepass()
|
|
|
|
+ {
|
|
|
|
+ terror.SetActive(false);
|
|
|
|
+ terror2.SetActive(false);
|
|
|
|
+ terror3.SetActive(false);
|
|
|
|
+ int ct = checkpass(inputnew1.text).ct;
|
|
if(ct>=3&&inputnew1.text.Length>=8)
|
|
if(ct>=3&&inputnew1.text.Length>=8)
|
|
{
|
|
{
|
|
string oldpass = AesEncryption.Encrypt(inputold.text);
|
|
string oldpass = AesEncryption.Encrypt(inputold.text);
|
|
@@ -112,7 +127,7 @@ public class ChangePass : MonoBehaviour
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- terror3.GetComponent<Text>().text = msg;
|
|
|
|
|
|
+ terror3.GetComponent<Text>().text = checkpass(inputnew1.text).msg;
|
|
terror3.SetActive(true);
|
|
terror3.SetActive(true);
|
|
}
|
|
}
|
|
|
|
|