@@ -179,6 +179,7 @@ const authSetup = function () {
179179 } ;
180180
181181 const login = function ( ) {
182+ logger ( 'returnUrl' , returnAppUrl ) ;
182183 auth0
183184 . loginWithRedirect ( {
184185 redirect_uri : host + '?appUrl=' + returnAppUrl ,
@@ -624,22 +625,27 @@ const authSetup = function () {
624625
625626 function handleSpecificReturnUrl ( value , param ) {
626627 try {
627- const domain = getHostDomain ( ) ;
628+ let hostdomain = "" ;
629+ if ( location . hostname !== 'localhost' ) {
630+ hostdomain = "." + location . hostname . split ( '.' ) . reverse ( ) [ 1 ] +
631+ "." + location . hostname . split ( '.' ) . reverse ( ) [ 0 ] ;
632+ }
628633 const prefixArray = [ 'apps' , 'software' ] ;
629- if ( domain ) {
634+ if ( hostdomain ) {
630635 for ( let i = 0 ; i < prefixArray . length ; i ++ ) {
631- if ( value . indexOf ( prefixArray [ i ] + domain ) > - 1 ) {
636+ if ( value . indexOf ( prefixArray [ i ] + hostdomain ) > - 1 ) {
632637 const queryParam = window . location . search . substr ( 1 ) ;
633638 if ( queryParam ) {
634639 const indx = queryParam . indexOf ( param ) ;
635640 if ( indx > - 1 ) {
636641 //assuming queryParam value like retUrl=xxxxxx
637642 const result = queryParam . substring ( indx + param . length + 1 ) ;
638643 // verify broken url : https://abc.com/&utm=abc
644+ logger ( 'handleSpecificReturnUrl: match query result' , result ) ;
639645 if ( result . indexOf ( '&' ) > - 1 && result . indexOf ( '?' ) === - 1 ) {
640646 return value ;
641647 }
642- return result ;
648+ return encodeURIComponent ( decodeURIComponent ( result ) ) ;
643649 } else {
644650 return value ;
645651 }
0 commit comments