fleet/ee/vulnerability-dashboard/api/responses/expired.js
Eric b1945b2128
Add fleet-vulnerability-dashboard repo to ee/ folder (#17428)
Closes: https://github.com/fleetdm/confidential/issues/4057

Changes:
- Added the contents of the fleet-vulnerability-dashboard repo to
ee/vulnerability-dashboard
- Added a github workflow to deploy the vulnerability dashboard on
Heroku
- Added a github workflow to test changes to the vulnerability-dashboard
- Updated the website's custom configuration to enable
auto-approvals/review requests to files in the
ee/vulnerability-dashboard folder
2024-03-13 13:06:11 -05:00

37 lines
821 B
JavaScript

/**
* expired.js
*
* A custom response that content-negotiates the current request to either:
* • serve an HTML error page about the specified token being invalid or expired
* • or send back 498 (Token Expired/Invalid) with no response body.
*
* Example usage:
* ```
* return res.expired();
* ```
*
* Or with actions2:
* ```
* exits: {
* badToken: {
* description: 'Provided token was expired, invalid, or already used up.',
* responseType: 'expired'
* }
* }
* ```
*/
module.exports = function expired() {
var req = this.req;
var res = this.res;
sails.log.verbose('Ran custom response: res.expired()');
if (req.wantsJSON) {
return res.status(498).send('Token Expired/Invalid');
}
else {
return res.status(498).view('498');
}
};