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.
|
|
namespace Business.KftcPasswordRule { /// <summary>
/// </summary>
public class MobileNumberRule : PasswordRule { /// <summary>
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public PasswordValidationResult Validate(ValidationModel model) { string mobileNum = ""; if (model.MobileNo.Contains("+82")) { mobileNum = model.MobileNo.Replace("+82", "0"); } else { string mobileFirst2 = model.MobileNo.Substring(0, 2);
if (mobileFirst2 == "82") { mobileNum = "0" + model.MobileNo.Substring(2, model.MobileNo.Length - 2); } else if (model.MobileNo.Substring(0, 1) != "0" && model.MobileNo.Length == 10) { mobileNum = "0" + mobileNum; } else { mobileNum = model.MobileNo; } } string mobileNum1 = mobileNum.Substring(3, mobileNum.Length - 3);
if (model.Password.Contains(mobileNum1)) { return new PasswordValidationResult { IsValid = false, Message = "Password can not be same as mobile number!" }; } return new PasswordValidationResult { IsValid = true, Message = "valid" }; } } }
|