File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,13 @@ export class ErrorHanlderInterceptor implements HttpInterceptor {
4242 let snackBarRef = this . notificationService . showInfo ( res ) ;
4343
4444 snackBarRef . afterDismissed ( ) . subscribe ( ( ) => {
45+ let returnUrl = this . router . url ;
46+ // Only allow relative paths
47+ if ( ! returnUrl . startsWith ( '/' ) ) {
48+ returnUrl = '/' ;
49+ }
4550 window . location . href =
46- '/account/login?returnUrl=' + this . router . url ;
51+ '/account/login?returnUrl=' + returnUrl ;
4752 } ) ;
4853 } ) ;
4954 }
Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ export class AppHeaderComponent implements OnInit {
1919 ngOnInit ( ) : void {
2020 this . router . events . subscribe ( ( event ) => {
2121 if ( event instanceof NavigationEnd ) {
22- this . url = this . router . url ;
22+ let currentUrl = this . router . url ;
23+ // Only allow relative paths
24+ if ( currentUrl . startsWith ( '/' ) ) {
25+ this . url = currentUrl ;
26+ } else {
27+ this . url = '/' ;
28+ }
2329 }
2430 } ) ;
2531 }
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ public async Task<ActionResult<String>> GetAccountId()
2727 [ Route ( "login" ) ]
2828 public IActionResult Login ( string returnUrl = "/" )
2929 {
30+ if ( string . IsNullOrEmpty ( returnUrl ) || ! Url . IsLocalUrl ( returnUrl ) )
31+ {
32+ returnUrl = "/" ;
33+ }
34+
3035 return Challenge ( new AuthenticationProperties ( ) { RedirectUri = returnUrl , AllowRefresh = true } ) ;
3136 }
3237
You can’t perform that action at this time.
0 commit comments