@@ -20,12 +20,10 @@ $(document).ready(function () {
2020 $ ( "#error" ) . closest ( ".message" ) . fadeOut ( ) ;
2121 $ ( "#error" ) . html ( "" ) ;
2222 let formAction = qs [ "formAction" ] ;
23- console . log ( formAction )
2423 const opt1 = 'https://auth.{{DOMAIN}}/continue' ;
2524 const opt2 = 'https://{{AUTH0DOMAIN}}/continue' ;
2625 if ( ! formAction . startsWith ( opt1 ) && ! formAction . startsWith ( opt2 ) ) {
2726 // looks like XSS attack
28- console . log ( "err" )
2927 formAction = "#" ;
3028 }
3129 $ ( '#verifyOtp' ) . attr ( 'action' , formAction ) ;
@@ -34,6 +32,42 @@ $(document).ready(function () {
3432 $ ( "#verifyOtp" ) . submit ( ) ;
3533 return false ;
3634 } ) ;
35+ const resendToken = qs [ "resendToken" ] ;
36+ const userId = qs [ "userId" ] ;
37+ if ( resendToken && userId ) {
38+ const apiServerUrl = "https://api.{{DOMAIN}}.com/v3/users" ;
39+ $ ( "#resend" ) . click ( function ( ) {
40+ $ . ajax ( {
41+ type : "POST" ,
42+ url : apiServerUrl + "/resendOtpEmail" ,
43+ contentType : "application/json" ,
44+ mimeType : "application/json" ,
45+ data : JSON . stringify ( {
46+ "param" : {
47+ userId, resendToken
48+ }
49+ } ) ,
50+ dataType : "json" ,
51+ success : function ( result ) {
52+ $ ( "#notify" ) . html ( "Email sent" ) ;
53+ $ ( "#notify" ) . closest ( ".message" ) . fadeIn ( ) ;
54+ $ ( "#resend" ) . hide ( ) ;
55+ } ,
56+ error : function ( error ) {
57+ if ( error . responseJSON && error . responseJSON . result ) {
58+ $ ( "#error" ) . html ( error . responseJSON . result . content ) ;
59+ $ ( "#error" ) . closest ( ".message" ) . fadeIn ( ) ;
60+ $ ( "#resend" ) . hide ( ) ;
61+ } else {
62+ $ ( "#error" ) . html ( "Unknown Error" ) ;
63+ $ ( "#error" ) . closest ( ".message" ) . fadeIn ( ) ;
64+ }
65+ }
66+ } ) ;
67+ } ) ;
68+ } else {
69+ $ ( "#resend" ) . hide ( ) ;
70+ }
3771
3872 /**
3973 * Script for field placeholder
0 commit comments