Moved logic to the Utilities class.
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
@namespace Oqtane.Modules.Admin.Register
|
@namespace Oqtane.Modules.Admin.Register
|
||||||
@using System.Text.RegularExpressions;
|
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@ -50,7 +49,7 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_message = "";
|
_message = "";
|
||||||
IsValidEmail();
|
_isEmailValid = Utilities.IsValidEmail(_email);
|
||||||
if (_username != "" && _password != "" && _confirm != "" && _isEmailValid)
|
if (_username != "" && _password != "" && _confirm != "" && _isEmailValid)
|
||||||
{
|
{
|
||||||
if (_password == _confirm)
|
if (_password == _confirm)
|
||||||
@ -97,16 +96,4 @@
|
|||||||
{
|
{
|
||||||
NavigationManager.NavigateTo(NavigateUrl(""));
|
NavigationManager.NavigateTo(NavigateUrl(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IsValidEmail()
|
|
||||||
{
|
|
||||||
if (_email != ""){
|
|
||||||
_isEmailValid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_isEmailValid = Regex.IsMatch(_email,
|
|
||||||
@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
|
|
||||||
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-0-9a-z]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
|
|
||||||
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
using System.Globalization;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Oqtane.Shared
|
namespace Oqtane.Shared
|
||||||
{
|
{
|
||||||
@ -217,5 +219,18 @@ namespace Oqtane.Shared
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsValidEmail(string email)
|
||||||
|
{
|
||||||
|
if (email != "")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Regex.IsMatch(email,
|
||||||
|
@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
|
||||||
|
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-0-9a-z]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
|
||||||
|
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user