0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 17:02:40 +00:00

proper error page

This commit is contained in:
Víctor Losada Hernández
2024-06-16 17:06:18 +02:00
parent 6e0aff525f
commit f15c831b70
5 changed files with 24 additions and 14 deletions

View File

@@ -5,9 +5,11 @@ const Markdown = require('../../../../shared/naturalcrit/markdown.js');
const ErrorIndex = require('./errors/errorIndex.js'); const ErrorIndex = require('./errors/errorIndex.js');
const ErrorPage = ({ brew })=>{ const ErrorPage = ({ brew })=>{
// Retrieving the error text based on the brew's error code from ErrorIndex // Retrieving the error text based on the brew's error code from ErrorIndex
const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || ''; const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || '';
console.log(errorText);
return ( return (
<UIPage brew={{ title: 'Crit Fail!' }}> <UIPage brew={{ title: 'Crit Fail!' }}>
<div className='dataGroup'> <div className='dataGroup'>

View File

@@ -147,6 +147,22 @@ const errorIndex = (props)=>{
**Brew ID:** ${props.brew.brewId} **Brew ID:** ${props.brew.brewId}
**Brew Title:** ${props.brew.brewTitle}`, **Brew Title:** ${props.brew.brewTitle}`,
'470' : dedent`
## You have runned out of attempts
You are trying to access the admin page, reserved for the administrators of this tool.
This is not a page where regular users should be, please, refrain from further access attempts.
:
If you are a part of the administrators team who does not remember the correct credentials,
please get in contact with the rest of the team before trying again.
:
In any case, your attempts have been logged, and you will not be capable of doing any more attempt for now.
`,
}; };
}; };

8
package-lock.json generated
View File

@@ -7255,14 +7255,6 @@
"node": ">=10.17.0" "node": ">=10.17.0"
} }
}, },
"node_modules/i": {
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/i/-/i-0.3.7.tgz",
"integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==",
"engines": {
"node": ">=0.4"
}
},
"node_modules/iconv-lite": { "node_modules/iconv-lite": {
"version": "0.4.24", "version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",

View File

@@ -7,9 +7,9 @@ const rateLimit = require('express-rate-limit');
// Define rate limiter options // Define rate limiter options
const loginLimiter = rateLimit({ const loginLimiter = rateLimit({
timeWindow: 24 * 60 * 60 * 1000, // 24 hours window timeWindow : 24 * 60 * 60 * 1000, // 24 hours window
max: 10, // limit each IP to 10 requests per timeWindow max : 10, // limit each IP to 10 requests per timeWindow
message: "Too many login attempts from this IP, please try again later" handler : ()=>{throw { HBErrorCode: '470', code: 470, message: 'Too many failed login attempts, try again later' }; }
}); });
//Local version username and password //Local version username and password

View File

@@ -29,12 +29,12 @@
"baseSnippets": false, "baseSnippets": false,
"path": "Blank" "path": "Blank"
}, },
"Journal": { "journal": {
"name": "Journal", "name": "Journal",
"renderer": "V3", "renderer": "V3",
"baseTheme": false, "baseTheme": false,
"baseSnippets": "5ePHB", "baseSnippets": "5ePHB",
"path": "Journal" "path": "journal"
} }
} }
} }