symbol regex fix
This commit is contained in:
parent
70c772cd3b
commit
0f073a7457
3 changed files with 5 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using WebsitePanel.Providers.HostedSolution;
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
|
@ -53,9 +54,9 @@ namespace WebsitePanel.WebDavPortal.CustomAttributes
|
||||||
|
|
||||||
if (settings.PasswordComplexityEnabled)
|
if (settings.PasswordComplexityEnabled)
|
||||||
{
|
{
|
||||||
var symbolsCount = valueString.Count(Char.IsSymbol);
|
|
||||||
var numbersCount = valueString.Count(Char.IsDigit);
|
var numbersCount = valueString.Count(Char.IsDigit);
|
||||||
var upperLetterCount = valueString.Count(Char.IsUpper);
|
var upperLetterCount = valueString.Count(Char.IsUpper);
|
||||||
|
var symbolsCount = Regex.Matches(valueString, @"[~!@#$%^&*_\-+'\|\\(){}\[\]:;\""'<>,.?/]").Count;
|
||||||
|
|
||||||
if (upperLetterCount < settings.UppercaseLettersCount)
|
if (upperLetterCount < settings.UppercaseLettersCount)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ $.validator.addMethod("numberscount", function (value, element, count) {
|
||||||
$.validator.unobtrusive.adapters.addSingleVal("symbolscount", "count");
|
$.validator.unobtrusive.adapters.addSingleVal("symbolscount", "count");
|
||||||
|
|
||||||
$.validator.addMethod("symbolscount", function (value, element, count) {
|
$.validator.addMethod("symbolscount", function (value, element, count) {
|
||||||
if (value.replace(/[a-zA-Z0-9_]/g, "").length < count) {
|
if (value.replace(/[^~!@#$%^&*_\-+'\|\\(){}\[\]:;\"'<>,.?/]/g, "").length < count) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
<div class="container row">
|
<div class="container row">
|
||||||
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetFinalStep, FormMethod.Post, new { @class = "form-horizontal user-password-reset-final-step bs-val-styles col-lg-9 col-lg-offset-3", id = "user-password-reset" }))
|
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetFinalStep, FormMethod.Post, new { @class = "form-horizontal user-password-reset-final-step bs-val-styles col-lg-9 col-lg-offset-3", id = "user-password-reset" }))
|
||||||
{
|
{
|
||||||
|
@Html.HiddenFor(x=>x.Login)
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h3>@UI.PasswordReset</h3>
|
<h3>@UI.PasswordReset</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue