File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2626// Require GocContextPath which is used in most of the views scripts
2727require_once __DIR__ .'/GocContextPath.php ' ;
2828
29+ use org \gocdb \security \authentication \BadCredentialsException ;
30+
2931// Set the timezone
3032date_default_timezone_set ("UTC " );
3133
@@ -84,6 +86,18 @@ function rejectIfNotAuthenticated($message = null){
8486try {
8587 Draw_Page ($ Page_Type );
8688
89+ } catch (BadCredentialsException $ error ) {
90+ /**
91+ * `show_view('error.php', ...` is not suitable here.
92+ * - setting raw to FALSE triggers another exception because it tries
93+ * to render a pretty error in a GOCDB window, which fails because the
94+ * user isn't authroised.
95+ * - setting raw to TRUE also isn't ideal as it displays html tags in the
96+ * otherwise nicely formatted output.
97+ * die-ing like this atleast gives the user a somewhart nicely formatted
98+ * error.
99+ */
100+ die ($ error ->getMessage ());
87101} catch (ErrorException $ e ) {
88102 /* ErrorExceptions may be thrown by an invalid configuration so it is
89103 not safe to try to give a pretty output. Set 'raw' to true. */
You can’t perform that action at this time.
0 commit comments