Mercurial Hosting > nabble
changeset 34:61800d34be0d
whitelist
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 09:44:17 -0600 |
parents | 442ace8fd8ed |
children | 5ea557eece1f |
files | src/nabble/view/web/more/ForumStart.java src/nabble/view/web/more/ForumStart.jtp |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/nabble/view/web/more/ForumStart.java Mon Jul 06 22:29:03 2020 -0600 +++ b/src/nabble/view/web/more/ForumStart.java Tue Jul 07 09:44:17 2020 -0600 @@ -10,6 +10,7 @@ import nabble.model.ModelHome; import nabble.model.Site; import nabble.model.User; +import nabble.model.Init; import nabble.naml.compiler.Template; import nabble.naml.compiler.TemplatePrintWriter; import nabble.naml.namespaces.BasicNamespace; @@ -32,6 +33,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; @@ -183,6 +185,8 @@ } + private static final Set whitelist = (Set)Init.get("whitelist"); + public static class Save extends HttpServlet { private static String get(String name, HttpServletRequest request) { @@ -230,6 +234,11 @@ } if (errors.isEmpty()) { + if( whitelist!=null && !whitelist.contains(email) ) { + logger.info("ignoring "+email); + return; + } + DbDatabase db = Db.dbGlobal(); db.beginTransaction(); try {
--- a/src/nabble/view/web/more/ForumStart.jtp Mon Jul 06 22:29:03 2020 -0600 +++ b/src/nabble/view/web/more/ForumStart.jtp Tue Jul 07 09:44:17 2020 -0600 @@ -10,6 +10,7 @@ import nabble.model.ModelHome; import nabble.model.Site; import nabble.model.User; +import nabble.model.Init; import nabble.naml.compiler.Template; import nabble.naml.compiler.TemplatePrintWriter; import nabble.naml.namespaces.BasicNamespace; @@ -32,6 +33,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; @@ -248,6 +250,8 @@ } + private static final Set whitelist = (Set)Init.get("whitelist"); + public static class Save extends HttpServlet { private static String get(String name, HttpServletRequest request) { @@ -295,6 +299,11 @@ } if (errors.isEmpty()) { + if( whitelist!=null && !whitelist.contains(email) ) { + logger.info("ignoring "+email); + return; + } + DbDatabase db = Db.dbGlobal(); db.beginTransaction(); try {