added rate limit message and fixed application header arrows

This commit is contained in:
Martina 2020-11-16 20:17:09 -08:00
parent ed9c40c861
commit c8d6607e53
3 changed files with 17 additions and 7 deletions

View File

@ -137,6 +137,7 @@ export const error = {
SERVER_NO_CIDS_TO_CHECK: "No CIDs were entered, please check your input",
//Users Create
SIGN_UP_RATE_LIMITED: "Too many sign up attempts. Please try again in 10 minutes",
SERVER_EXISTING_USER_ALREADY: "That username is taken. Please try another one",
EXISTING_USER_ALREADY: "That username is taken. Please try another one",
INVALID_USERNAME: "Invalid username. Please include only letters and numbers",
@ -185,6 +186,7 @@ export const error = {
"We're havign trouble fetching your information right now. Please try again",
//Sign-in
SIGN_IN_RATE_LIMITED: "Too many sign in attempts. Please try again in 10 minutes",
SIGN_IN: "Your username/password can't be blank",
SERVER_SIGN_IN: "Your username/password can't be blank",
SIGN_IN_USER_NOT_FOUND: "We're having trouble logging you in right now, please try again later",

View File

@ -240,11 +240,11 @@ export default class ApplicationHeader extends React.Component {
</span>
<span
css={STYLES_ICON_ELEMENT}
style={{
cursor: isForwardDisabled ? "not-allowed" : "default",
color: isForwardDisabled ? Constants.system.border : "auto",
marginLeft: 8,
}}
style={
isForwardDisabled
? { cursor: "not-allowed", color: Constants.system.border, marginLeft: 8 }
: { marginLeft: 8 }
}
onClick={isForwardDisabled ? () => {} : this.props.onForward}
>
<SVG.NavigationArrow height="24px" />

View File

@ -28,13 +28,21 @@ const app = next({
const createLimiter = limit({
windowMs: 10 * 60 * 1000, // 10 minutes
max: 5,
message: { decorator: "RATE_LIMITED", error: true, message: "You have made too many requests." },
message: {
decorator: "SIGN_UP_RATE_LIMITED",
error: true,
message: "You have made too many requests.",
},
});
const loginLimiter = limit({
windowMs: 10 * 60 * 1000, // 10 minutes
max: 5,
message: { decorator: "RATE_LIMITED", error: true, message: "You have made too many requests." },
message: {
decorator: "SIGN_IN_RATE_LIMITED",
error: true,
message: "You have made too many requests.",
},
});
const handler = app.getRequestHandler();