0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +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 ErrorPage = ({ brew })=>{
// Retrieving the error text based on the brew's error code from ErrorIndex
const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || '';
console.log(errorText);
return (
<UIPage brew={{ title: 'Crit Fail!' }}>
<div className='dataGroup'>

View File

@@ -147,6 +147,22 @@ const errorIndex = (props)=>{
**Brew ID:** ${props.brew.brewId}
**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_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": {
"version": "0.4.24",
"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
const loginLimiter = rateLimit({
timeWindow: 24 * 60 * 60 * 1000, // 24 hours window
max: 10, // limit each IP to 10 requests per timeWindow
message: "Too many login attempts from this IP, please try again later"
timeWindow : 24 * 60 * 60 * 1000, // 24 hours window
max : 10, // limit each IP to 10 requests per timeWindow
handler : ()=>{throw { HBErrorCode: '470', code: 470, message: 'Too many failed login attempts, try again later' }; }
});
//Local version username and password

View File

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