@page "/login" @using BootStrapComponents @using Components @using Models.Identity @layout LayoutWithoutMenu

ورود / ثبت نام

@if (!WaitForOtp) { لطفا شماره همراه خود را وارد کنید. } else { لطفا کد تائید پیامک شده را وارد کنید. }

@if (!WaitForOtp) { } else { }

ورود شما به معنای پذیرش شرایط حق‌تو و قوانین حریم خصوصی است


© تمامی حقوق برای حقتو محفوظ میباشد


ورژن 1.1

@code { private bool WaitForOtpMode { get; set; } = true; protected OTPLoginModel OtpLoginModel { get; set; } = new(); protected bool WaitForOtp { set; get; } = false; public async void Submit() { if (WaitForOtp) await RequestLogin(); else await RequestVerificationCode(); } protected async Task RequestVerificationCode() { var response = await _userUtils.SendVerificationRequest(OtpLoginModel); if (response.IsSuccessStatusCode) WaitForOtp = true; StateHasChanged(); } protected LoginModel LoginModel { get; set; } = new(); protected async Task RequestLogin() { LoginModel.Username = OtpLoginModel.Username; var response = await _userUtils.LoginWithPasswordRequest(LoginModel); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadFromJsonAsync(); await LocalStorage.SetItemAsync(Statics.LoginTokenKey, result.AccessToken); NavManager.NavigateTo("/dashboard"); } } }