diff --git a/Common/Validation/FixedValidation.cs b/Common/Validation/FixedValidation.cs index fffd221..de1eb83 100644 --- a/Common/Validation/FixedValidation.cs +++ b/Common/Validation/FixedValidation.cs @@ -38,7 +38,19 @@ namespace Common.Validation public static bool CheckUsername(this string Username) => (Username.Length == 11 && Username.StartsWith("09")) || (Username.Length == 9 && Username.StartsWith("E/")); - public static bool CheckMobile(this string Mobile) => Mobile.Length == 11 && Mobile.StartsWith("09"); + public static bool CheckMobile(this string Mobile) + { + bool pars = true; + foreach (var item in Mobile.ToCharArray()) + { + if(!Int32.TryParse(item.ToString(),out int _)) + { + pars = false; + break; + } + } + return pars && Mobile.Length == 11 && Mobile.StartsWith("09"); + } public static bool IsValidEmail(this string email) { // الگوی ساده اما معتبر برای بررسی ایمیل diff --git a/Presentation/HushianWebApp/Pages/FromUserSide/LoginComponent.razor b/Presentation/HushianWebApp/Pages/FromUserSide/LoginComponent.razor index 1ab07b7..401118e 100644 --- a/Presentation/HushianWebApp/Pages/FromUserSide/LoginComponent.razor +++ b/Presentation/HushianWebApp/Pages/FromUserSide/LoginComponent.razor @@ -1,62 +1,74 @@ -@using HushianWebApp.Service +@using Common.Validation +@using HushianWebApp.Service @inject AuthService AuthService +@inject VerificationService verificationService;
نیاز برای ارتباط با کارشناسان وارد شود
- + - @if (ID==0) - { - -
+ @if (ID==0) + { + + +
-
- +
+ +
+ +
+ } + else{ + + +
+ +
+ + + + + + + + +
- -
- } - else{ - - -
- -
- - - - - - - - -
- -
- } + }
@@ -70,17 +82,27 @@ //----------------- private string code1, code2, code3, code4; private ElementReference input1, input2, input3, input4; + string validateStyleUser=""; } @functions{ async Task Login() { - visible = true; - ID= await AuthService.login(new Common.Models.Auth.UserSide.AuthRequestFromUserSide() + if (Username.Replace("-","").CheckMobile()) { - Mobile=Username - }); - - visible = false; + visible = true; + ID = await AuthService.login(new Common.Models.Auth.UserSide.AuthRequestFromUserSide() + { + Mobile = Username.Replace("-", "") + }); + validateStyleUser = ""; + + visible = false; + } + else + { + validateStyleUser =" border: 2px solid red; border-radius: 4px;"; + } + } async Task ver() { @@ -119,7 +141,27 @@ } } } +