File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Assets/Thirdweb/Core/Scripts/WalletsUI Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1111using System ;
1212using System . Linq ;
1313using System . Collections . Generic ;
14+ using UnityEngine . Events ;
1415
1516namespace Thirdweb . Wallets
1617{
@@ -26,6 +27,9 @@ public class EmbeddedWalletUI : MonoBehaviour
2627 public TMP_Text RecoveryCodesText ;
2728 public Button RecoveryCodesCopy ;
2829
30+ [ Tooltip ( "Invoked when the user submits an invalid OTP and can retry." ) ]
31+ public UnityEvent OnEmailOTPVerificationFailed ;
32+
2933 private EmbeddedWallet _embeddedWallet ;
3034 private string _email ;
3135 private User _user ;
@@ -174,6 +178,16 @@ private async void OnSubmitOTP()
174178 {
175179 string otp = OTPInput . text ;
176180 var res = await _embeddedWallet . VerifyOtpAsync ( _email , otp , string . IsNullOrEmpty ( RecoveryInput . text ) ? null : RecoveryInput . text ) ;
181+ if ( res . User == null )
182+ {
183+ if ( res . CanRetry && OnEmailOTPVerificationFailed . GetPersistentEventCount ( ) > 0 )
184+ {
185+ OnEmailOTPVerificationFailed . Invoke ( ) ;
186+ return ;
187+ }
188+ _exception = new UnityException ( "User OTP Verification Failed." ) ;
189+ return ;
190+ }
177191 _user = res . User ;
178192 ShowRecoveryCodes ( res ) ;
179193 }
You can’t perform that action at this time.
0 commit comments