disallow certain characters in nicknames

This commit is contained in:
Zlatin Balevsky
2020-05-06 11:49:52 +01:00
parent d18cdb15cd
commit 58a92e7442

View File

@ -8,6 +8,9 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.muwire.core.Constants;
import com.muwire.core.util.DataUtil;
public class InitServlet extends HttpServlet {
@Override
@ -17,6 +20,9 @@ public class InitServlet extends HttpServlet {
if (nickname == null || nickname.trim().length() == 0)
throw new Exception("Nickname cannot be blank");
if (!DataUtil.isValidName(nickname))
throw new Exception("Nickname cannot contain any of " + Constants.INVALID_NICKNAME_CHARS);
String downloadLocation = req.getParameter("download_location");
if (downloadLocation == null)
throw new Exception("Download location cannot be blank");