fix: negative sentiment → neutral language (#39522)

The existing terminology carries negative sentiment that can be
interpreted in a racial or sense. Updating the name to have no
potential for such a connection.

Co-authored-by: Justin Rogers <justrog@gmail.com>
This commit is contained in:
Mrugesh Mohapatra
2020-09-07 11:04:44 +05:30
committed by GitHub
parent b93785be5d
commit c23c4ef8e4
13 changed files with 40 additions and 34 deletions

View File

@ -28,7 +28,7 @@ const updateHooksRE = /^\/hooks\/update-paypal$|^\/hooks\/update-stripe$/;
// note: this would be replaced by webhooks later
const donateRE = /^\/donate\/charge-stripe$/;
const _whiteListREs = [
const _pathsAllowedREs = [
authRE,
confirmEmailRE,
newsShortLinksRE,
@ -44,14 +44,14 @@ const _whiteListREs = [
donateRE
];
export function isWhiteListedPath(path, whiteListREs = _whiteListREs) {
return whiteListREs.some(re => re.test(path));
export function isAllowedPath(path, pathsAllowedREs = _pathsAllowedREs) {
return pathsAllowedREs.some(re => re.test(path));
}
export default ({ jwtSecret = _jwtSecret, getUserById = _getUserById } = {}) =>
function requestAuthorisation(req, res, next) {
const { path } = req;
if (!isWhiteListedPath(path)) {
if (!isAllowedPath(path)) {
const { accessToken, error, jwt } = getAccessTokenFromRequest(
req,
jwtSecret