File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import {getElemsByClass, getElemById} from './ts/dom-utils';
44import { widgetFactory } from './ts/widget' ;
55import { scrollTop } from './ts/scrolltop' ;
66
7+ // #if STAGING
8+ import { stagingRedirect } from './ts/staging' ;
9+ // #endif
10+
711/**
812 * Entrypoint
913 * The main entrypoint for the application
@@ -17,6 +21,12 @@ function entrypoint(): void {
1721 // register scroll to top btn functionality
1822 const btn = getElemById ( 'scrollToTopBtn' ) ;
1923 scrollTop ( btn as HTMLButtonElement ) ;
24+
25+ // #if STAGING
26+ // This is used to redirect non AdaCore staff to the main site if
27+ // the staging site is accidentally reached
28+ stagingRedirect ( ) ;
29+ // #endif
2030}
2131
2232( function ( ) : void {
Original file line number Diff line number Diff line change 1+ import Cookies from 'js-cookie' ;
2+
3+ /**
4+ * Redirects the user to main learn site if not AdaCore employee
5+ *
6+ * @export
7+ */
8+ export function stagingRedirect ( ) : void {
9+ /* istanbul ignore next */
10+ if ( ! Cookies . get ( 'AdaCore_staff' ) ) {
11+ const msg = 'You have reached learn-staging, the learn testing site. ' +
12+ 'This is reserved for testers only. You will be directed to the main ' +
13+ 'learn.adacore.com site after pressing OK.' ;
14+ alert ( msg ) ;
15+ window . location . href = 'http://learn.adacore.com' ;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments