feat: add referral code support to phone verification form
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 5m9s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 5m9s
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user