feat: add referral code support to phone verification form
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 5m9s

This commit is contained in:
masoodafar-web
2026-04-29 00:46:53 +03:30
parent 647e596050
commit b00af9e326
4 changed files with 37 additions and 4 deletions
@@ -42,6 +42,9 @@ public partial class AuthDialog : IDisposable
private string? _captchaCode;
private string? _captchaInput;
// Referral code field
private string? _referralCode;
[Inject] private ILocalStorageService LocalStorage { get; set; } = default!;
[Inject] private UserContract.UserContractClient UserClient { get; set; } = default!;
@@ -66,9 +69,20 @@ public partial class AuthDialog : IDisposable
{
_phoneRequest.Mobile = storedPhone;
}
_referralCode = await LocalStorage.GetItemAsync<string>("referral:code");
// await LocalStorage.RemoveItemAsync(TokenStorageKey);
}
private async Task OnReferralCodeChanged(string? value)
{
_referralCode = value;
if (!string.IsNullOrWhiteSpace(value))
await LocalStorage.SetItemAsync("referral:code", value);
else
await LocalStorage.RemoveItemAsync("referral:code");
}
private void GenerateCaptcha()
{
_captchaCode = Guid.NewGuid().ToString("N")[..6].ToUpperInvariant();
@@ -182,9 +196,12 @@ public partial class AuthDialog : IDisposable
_verifyRequest.Mobile = _phoneNumber;
var storedReferralCode = await LocalStorage.GetItemAsync<string>("referral:code");
if (!string.IsNullOrWhiteSpace(storedReferralCode))
var effectiveReferralCode = !string.IsNullOrWhiteSpace(_referralCode)
? _referralCode
: storedReferralCode;
if (!string.IsNullOrWhiteSpace(effectiveReferralCode))
{
_verifyRequest.ParentReferralCode = storedReferralCode;
_verifyRequest.ParentReferralCode = effectiveReferralCode;
}
var validationResult = true; // _verifyRequestValidator.Validate(_verifyRequest);