...
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<div class="form-container">
|
||||
<Spinner Class="me-3" Type="SpinnerType.Dots" Color="SpinnerColor.Primary" Visible="@visible" />
|
||||
|
||||
@if (ID==0)
|
||||
@if (ID == 0)
|
||||
{
|
||||
|
||||
<label for="user-name" class="block mb-2 text-slate-600 font-bold">
|
||||
@@ -37,7 +37,8 @@
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
<label for="user-name" class="block mb-2 text-slate-600 font-bold">
|
||||
جهت احراز کد ارسال شده را وارد کنید
|
||||
</label>
|
||||
@@ -68,6 +69,25 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<Button Color="ButtonColor.Link"
|
||||
Disabled="@isButtonDisabled"
|
||||
@onclick="async () =>
|
||||
{
|
||||
await verificationService.ReSendCode(ID);
|
||||
await verifiTimer();
|
||||
}"
|
||||
Style="padding: 6px 16px; font-size: 14px; background-color: #f8f9fa; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;margin-bottom: -10px;">
|
||||
|
||||
<span>ارسال مجدد</span>
|
||||
|
||||
@if (countdown > 0)
|
||||
{
|
||||
<span style="color: #dc3545; font-weight: bold;">(@countdown)</span>
|
||||
}
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,12 +102,15 @@
|
||||
//-----------------
|
||||
private string code1, code2, code3, code4;
|
||||
private ElementReference input1, input2, input3, input4;
|
||||
string validateStyleUser="";
|
||||
string validateStyleUser = "";
|
||||
private bool isButtonDisabled = true;
|
||||
private int countdown = 60;
|
||||
private System.Timers.Timer? timer;
|
||||
}
|
||||
@functions{
|
||||
@functions {
|
||||
async Task Login()
|
||||
{
|
||||
if (Username.Replace("-","").CheckMobile())
|
||||
if (Username.Replace("-", "").CheckMobile())
|
||||
{
|
||||
visible = true;
|
||||
ID = await AuthService.login(new Common.Models.Auth.UserSide.AuthRequestFromUserSide()
|
||||
@@ -95,19 +118,46 @@
|
||||
Mobile = Username.Replace("-", "")
|
||||
});
|
||||
validateStyleUser = "";
|
||||
|
||||
await verifiTimer();
|
||||
visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
validateStyleUser =" border: 2px solid red; border-radius: 4px;";
|
||||
validateStyleUser = " border: 2px solid red; border-radius: 4px;";
|
||||
}
|
||||
|
||||
}
|
||||
async Task verifiTimer()
|
||||
{
|
||||
//----------
|
||||
isButtonDisabled = true;
|
||||
countdown = 60;
|
||||
timer = new System.Timers.Timer(1000); // هر 1 ثانیه
|
||||
timer.Elapsed += OnTimerElapsed;
|
||||
timer.AutoReset = true;
|
||||
timer.Enabled = true;
|
||||
//----------
|
||||
}
|
||||
private void OnTimerElapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (countdown > 0)
|
||||
{
|
||||
countdown--;
|
||||
InvokeAsync(StateHasChanged); // بروزرسانی UI
|
||||
}
|
||||
|
||||
if (countdown == 0)
|
||||
{
|
||||
isButtonDisabled = false;
|
||||
timer?.Stop();
|
||||
timer?.Dispose();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
async Task ver()
|
||||
{
|
||||
visible = true;
|
||||
if(await AuthService.Verificationlogin(ID, Code))
|
||||
if (await AuthService.Verificationlogin(ID, Code))
|
||||
await OnMultipleOfThree.InvokeAsync();
|
||||
visible = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user