Add support for force re-login on expired credentials

On credential expiry (usually noticed via POST request), error ajax popup will reflect this, remove session vars, only allow you to redirect to login page.

Related changes:

- Allows ajax error handler to work with non-SGS errors as well
- Traceback now in `<pre>` tags to preserve newlines
- Error modal html-encodes entities such as `<` `>` etc