mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
Compare commits
27 Commits
v5.42.1
...
fiz/ToS-st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd06148422 | ||
|
|
a0b179561b | ||
|
|
9a1fb18959 | ||
|
|
2ea0b64603 | ||
|
|
bd1aa1e417 | ||
|
|
7c49b845d6 | ||
|
|
1ee172139d | ||
|
|
6447b9ab4b | ||
|
|
5c414099d9 | ||
|
|
5e8e1179aa | ||
|
|
7e86a62624 | ||
|
|
1ba9dda0ed | ||
|
|
227e5ceaa8 | ||
|
|
f77ab5a3ab | ||
|
|
1916faf647 | ||
|
|
80ecb5cef1 | ||
|
|
75c36e6622 | ||
|
|
78330c975a | ||
|
|
95266f6cb3 | ||
|
|
e9b2c1b51a | ||
|
|
2a2bea07ab | ||
|
|
ea60ddbf4c | ||
|
|
1c2ca0e478 | ||
|
|
ef2b7eb928 | ||
|
|
3d16387a61 | ||
|
|
93b7770eaa | ||
|
|
a9f84d3307 |
Submodule habitica-images updated: 992d838120...aa72332019
@@ -117,6 +117,15 @@ describe('Blocker middleware', () => {
|
|||||||
|
|
||||||
checkIPBlockedErrorThrown(next);
|
checkIPBlockedErrorThrown(next);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws when the ip is blocked', () => {
|
||||||
|
req.ip = '192.168.1.1';
|
||||||
|
sandbox.stub(nconf, 'get').withArgs('BLOCKED_IPS').returns('192.168.1.1');
|
||||||
|
const attachBlocker = requireAgain(pathToBlocker).default;
|
||||||
|
attachBlocker(req, res, next);
|
||||||
|
|
||||||
|
checkIPBlockedErrorThrown(next);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Blocking clients', () => {
|
describe('Blocking clients', () => {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ describe('POST /user/auth/local/login', () => {
|
|||||||
})).to.eventually.be.rejected.and.eql({
|
})).to.eventually.be.rejected.and.eql({
|
||||||
code: 401,
|
code: 401,
|
||||||
error: 'NotAuthorized',
|
error: 'NotAuthorized',
|
||||||
message: t('accountSuspended', { communityManagerEmail: nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL'), userId: user._id }),
|
message: t('accountSuspended', { communityManagerEmail: nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL'), userId: user._id, username: user.auth.local.username }),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ export default {
|
|||||||
const AUTH_SETTINGS = localStorage.getItem(LOCALSTORAGE_AUTH_KEY);
|
const AUTH_SETTINGS = localStorage.getItem(LOCALSTORAGE_AUTH_KEY);
|
||||||
const parseSettings = JSON.parse(AUTH_SETTINGS);
|
const parseSettings = JSON.parse(AUTH_SETTINGS);
|
||||||
const userId = parseSettings ? parseSettings.auth.apiId : '';
|
const userId = parseSettings ? parseSettings.auth.apiId : '';
|
||||||
|
const username = this.$store?.state?.user?.data?.auth?.local?.username || '';
|
||||||
|
|
||||||
return this.$t('accountSuspended', {
|
return this.$t('accountSuspended', {
|
||||||
userId,
|
userId,
|
||||||
|
username,
|
||||||
communityManagerEmail: COMMUNITY_MANAGER_EMAIL,
|
communityManagerEmail: COMMUNITY_MANAGER_EMAIL,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
"passwordReset": "If we have your email or username on file, instructions for setting a new password have been sent to your email.",
|
"passwordReset": "If we have your email or username on file, instructions for setting a new password have been sent to your email.",
|
||||||
"invalidLoginCredentialsLong": "Uh-oh - your email address / username or password is incorrect.\n- Make sure they are typed correctly. Your username and password are case-sensitive.\n- You may have signed up with Facebook or Google-sign-in, not email so double-check by trying them.\n- If you forgot your password, click \"Forgot Password\".",
|
"invalidLoginCredentialsLong": "Uh-oh - your email address / username or password is incorrect.\n- Make sure they are typed correctly. Your username and password are case-sensitive.\n- You may have signed up with Facebook or Google-sign-in, not email so double-check by trying them.\n- If you forgot your password, click \"Forgot Password\".",
|
||||||
"invalidCredentials": "There is no account that uses those credentials.",
|
"invalidCredentials": "There is no account that uses those credentials.",
|
||||||
"accountSuspended": "This account, User ID \"<%= userId %>\", has been blocked for breaking the Community Guidelines (https://habitica.com/static/community-guidelines) or Terms of Service (https://habitica.com/static/terms). For details or to ask to be unblocked, please email our Community Manager at <%= communityManagerEmail %> or ask your parent or guardian to email them. Please include your @Username in the email.",
|
"accountSuspended": "Your account @<%= username %> has been blocked. For additional information, or to request an appeal, email admin@habitica.com with your Habitica username or User ID.",
|
||||||
"accountSuspendedTitle": "Account has been suspended",
|
"accountSuspendedTitle": "Account has been suspended",
|
||||||
"unsupportedNetwork": "This network is not currently supported.",
|
"unsupportedNetwork": "This network is not currently supported.",
|
||||||
"cantDetachSocial": "Account lacks another authentication method; can't detach this authentication method.",
|
"cantDetachSocial": "Account lacks another authentication method; can't detach this authentication method.",
|
||||||
|
|||||||
@@ -187,5 +187,4 @@ api.deleteBlocker = {
|
|||||||
res.respond(200, savedBlocker);
|
res.respond(200, savedBlocker);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default api;
|
export default api;
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ export function loginRes (user, req, res) {
|
|||||||
if (user.auth.blocked) {
|
if (user.auth.blocked) {
|
||||||
throw new NotAuthorized(res.t(
|
throw new NotAuthorized(res.t(
|
||||||
'accountSuspended',
|
'accountSuspended',
|
||||||
{ communityManagerEmail: COMMUNITY_MANAGER_EMAIL, userId: user._id },
|
{
|
||||||
|
communityManagerEmail: COMMUNITY_MANAGER_EMAIL,
|
||||||
|
userId: user._id,
|
||||||
|
username: user.auth.local.username,
|
||||||
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
const urlPath = url.parse(req.url).pathname;
|
const urlPath = url.parse(req.url).pathname;
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export function authWithHeaders (options = {}) {
|
|||||||
throw new NotAuthorized(common.i18n.t('accountSuspended', {
|
throw new NotAuthorized(common.i18n.t('accountSuspended', {
|
||||||
communityManagerEmail: COMMUNITY_MANAGER_EMAIL,
|
communityManagerEmail: COMMUNITY_MANAGER_EMAIL,
|
||||||
userId: user._id,
|
userId: user._id,
|
||||||
|
username: user.auth.local.username,
|
||||||
}, language));
|
}, language));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import nconf from 'nconf';
|
||||||
import {
|
import {
|
||||||
Forbidden,
|
Forbidden,
|
||||||
} from '../libs/errors';
|
} from '../libs/errors';
|
||||||
@@ -9,7 +10,19 @@ import { model as Blocker } from '../models/blocker';
|
|||||||
// NOTE: it's meant to be used behind a proxy (for example a load balancer)
|
// NOTE: it's meant to be used behind a proxy (for example a load balancer)
|
||||||
// that uses the 'x-forwarded-for' header to forward the original IP addresses.
|
// that uses the 'x-forwarded-for' header to forward the original IP addresses.
|
||||||
|
|
||||||
const blockedIps = [];
|
// A list of comma separated IPs to block
|
||||||
|
// It works fine as long as the list is short,
|
||||||
|
// if the list becomes too long for an env variable we'll switch to Redis.
|
||||||
|
const BLOCKED_IPS_RAW = nconf.get('BLOCKED_IPS');
|
||||||
|
|
||||||
|
const blockedIps = BLOCKED_IPS_RAW
|
||||||
|
? BLOCKED_IPS_RAW
|
||||||
|
.trim()
|
||||||
|
.split(',')
|
||||||
|
.map(blockedIp => blockedIp.trim())
|
||||||
|
.filter(blockedIp => Boolean(blockedIp))
|
||||||
|
: [];
|
||||||
|
|
||||||
const blockedClients = [];
|
const blockedClients = [];
|
||||||
|
|
||||||
Blocker.watchBlockers({
|
Blocker.watchBlockers({
|
||||||
|
|||||||
Reference in New Issue
Block a user