From 5e6a295f119172d5bd12d9169070fbeb36e57b54 Mon Sep 17 00:00:00 2001 From: A Lawliet Date: Sat, 24 Jun 2017 15:50:44 -0400 Subject: [PATCH 1/2] Make highlight suspect/banned words regex case insensitive --- client/coral-admin/src/routes/Moderation/components/Comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/routes/Moderation/components/Comment.js b/client/coral-admin/src/routes/Moderation/components/Comment.js index 9b0477472..3c5e535b2 100644 --- a/client/coral-admin/src/routes/Moderation/components/Comment.js +++ b/client/coral-admin/src/routes/Moderation/components/Comment.js @@ -54,7 +54,7 @@ class Comment extends React.Component { // currently the highlighter plugin does not support out of the box. const searchWords = [...suspectWords, ...bannedWords] .filter((w) => { - return new RegExp(`(^|\\s)${w}(\\s|$)`).test(comment.body); + return new RegExp(`(^|\\s)${w}(\\s|$)`, 'i').test(comment.body); }) .concat(linkText); From a025f4ca24b17a5018fff02a2fdd8c0773a97df4 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 26 Jun 2017 17:35:45 +0700 Subject: [PATCH 2/2] Validate `confirmPassword` in the web installer --- client/coral-admin/src/actions/install.js | 22 +++++++++++++++++++ .../components/Steps/CreateYourAccount.js | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/actions/install.js b/client/coral-admin/src/actions/install.js index 122ffdc4a..33cefab63 100644 --- a/client/coral-admin/src/actions/install.js +++ b/client/coral-admin/src/actions/install.js @@ -66,6 +66,28 @@ const validation = (formData, dispatch, next) => { return; } + // Confirm Validation + const prefixLength = 'confirm'.length; + const confirm = validKeys + .filter((name) => { + if (!name.startsWith('confirm')) { + return false; + } + + // Check that 'confirmX' equals 'X'. + const other = name.substr(prefixLength, 1).toLowerCase() + name.substr(prefixLength + 1); + const cond = formData[other] !== formData[name]; + if (cond) { + dispatch(addError(name, errorMsj[name])); + } + return cond; + }); + + if (confirm.length) { + dispatch(hasError()); + return; + } + dispatch(clearErrors()); next(); }; diff --git a/client/coral-admin/src/routes/Install/components/Steps/CreateYourAccount.js b/client/coral-admin/src/routes/Install/components/Steps/CreateYourAccount.js index c5d334610..2a5b87e5f 100644 --- a/client/coral-admin/src/routes/Install/components/Steps/CreateYourAccount.js +++ b/client/coral-admin/src/routes/Install/components/Steps/CreateYourAccount.js @@ -48,7 +48,7 @@ const InitialStep = (props) => { label={t('install.create.confirm_password')} onChange={handleUserChange} showErrors={install.showErrors} - errorMsg={install.errors.confirm_password} + errorMsg={install.errors.confirmPassword} /> {