Skip to content

Commit c503426

Browse files
committed
Merge branch 'main' into hmac
2 parents 89cda29 + b6cb357 commit c503426

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

wrongsecrets-balancer/src/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ if (get('metrics.enabled')) {
2929
next();
3030
});
3131

32+
app.disable('x-powered-by');
33+
3234
app.get(
3335
'/balancer/metrics',
3436
basicAuth(get('metrics.basicAuth.username'), get('metrics.basicAuth.password')),

wrongsecrets-balancer/ui/src/pages/JoinPage.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,25 @@ export const JoinPage = injectIntl(({ intl }) => {
4646
const { formatMessage } = intl;
4747

4848
async function sendJoinRequest() {
49-
try {
50-
const hmacvalue = cryptoJS
51-
.HmacSHA256(`${teamname}`, 'hardcodedkey')
52-
.toString(cryptoJS.enc.Hex);
53-
const { data } = await axios.post(`/balancer/teams/${teamname}/join`, {
54-
passcode,
55-
hmacvalue,
56-
});
57-
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode } });
58-
} catch (error) {
59-
if (
60-
error.response.status === 401 &&
61-
error.response.data.message === 'Team requires authentication to join'
62-
) {
63-
navigate(`/teams/${teamname}/joining/`);
64-
} else {
65-
setFailed(true);
49+
if (window.confirm('Are you ready?')) {
50+
try {
51+
const hmacvalue = cryptoJS
52+
.HmacSHA256(`${teamname}`, 'hardcodedkey')
53+
.toString(cryptoJS.enc.Hex);
54+
const { data } = await axios.post(`/balancer/teams/${teamname}/join`, {
55+
passcode,
56+
hmacvalue,
57+
});
58+
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode } });
59+
} catch (error) {
60+
if (
61+
error.response.status === 401 &&
62+
error.response.data.message === 'Team requires authentication to join'
63+
) {
64+
navigate(`/teams/${teamname}/joining/`);
65+
} else {
66+
setFailed(true);
67+
}
6668
}
6769
}
6870
}

0 commit comments

Comments
 (0)