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 11
11
using System ;
12
12
using System . Linq ;
13
13
using System . Collections . Generic ;
14
+ using UnityEngine . Events ;
14
15
15
16
namespace Thirdweb . Wallets
16
17
{
@@ -26,6 +27,9 @@ public class EmbeddedWalletUI : MonoBehaviour
26
27
public TMP_Text RecoveryCodesText ;
27
28
public Button RecoveryCodesCopy ;
28
29
30
+ [ Tooltip ( "Invoked when the user submits an invalid OTP and can retry." ) ]
31
+ public UnityEvent OnEmailOTPVerificationFailed ;
32
+
29
33
private EmbeddedWallet _embeddedWallet ;
30
34
private string _email ;
31
35
private User _user ;
@@ -174,6 +178,16 @@ private async void OnSubmitOTP()
174
178
{
175
179
string otp = OTPInput . text ;
176
180
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
+ }
177
191
_user = res . User ;
178
192
ShowRecoveryCodes ( res ) ;
179
193
}
You can’t perform that action at this time.
0 commit comments