File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const authSetup = function () {
4646 const mode = qs [ 'mode' ] || 'signIn' ;
4747 let returnAppUrl = handleSpecificReturnUrl ( qs [ 'retUrl' ] , 'retUrl' ) ;
4848 let appUrl = qs [ 'appUrl' ] || false ;
49+ const discord_pattern = 'https://tc-topbot-1.herokuapp.com/' ;
4950
5051 if ( utmSource &&
5152 ( utmSource != 'undefined' ) &&
@@ -237,10 +238,22 @@ const authSetup = function () {
237238 }
238239
239240 const redirectToApp = function ( ) {
240- logger ( "redirect to app" , appUrl ) ;
241- if ( appUrl ) {
242- window . location = appUrl ;
241+ logger ( "redirect to app" , appUrl ) ;
242+ if ( appUrl ) {
243+ if ( appUrl . indexOf ( discord_pattern ) > - 1 ) {
244+ try {
245+ var newUrl = new URL ( appUrl ) ;
246+ window . location = newUrl . searchParams . append (
247+ "token" ,
248+ getCookie ( v3JWTCookie )
249+ ) . href ;
250+ } catch ( e ) {
251+ logger ( "Error in redirect to discord" , e . message )
252+ }
253+ } else {
254+ window . location = appUrl ;
243255 }
256+ }
244257 } ;
245258
246259 const postLogin = function ( ) {
You can’t perform that action at this time.
0 commit comments