<%
- if (request.getParameter("uname") != null
- && request.getParameter("uname").contains("@")
- && request.getParameter("uname").contains(".")
- && request.getParameter("fname") != null
- && request.getParameter("lname") != null) {
+ String emailParam = request.getParameter("uname");
+ String fnameParam = request.getParameter("fname");
+ String lnameParam = request.getParameter("lname");
+ if (emailParam.contains("@") && emailParam.contains(".") && fnameParam != null && lnameParam != null) {
//create a user with a blank password. Their password will be set when they are approved by an admin
- int result = user.User.signup(request.getParameter("uname"), request.getParameter("lname"), request.getParameter("fname"));
+ int result = user.User.signup(emailParam, fnameParam, lnameParam);
//total success
if (result == 0) {
out.println("
Your account was created. You will recieve an email from TPEN@t-pen.org when an administrator has activated your account. If your e-mail does not arrive, please verify that it has not been caught by a spam filter.
");
@@ -80,20 +79,15 @@
out.println("
Account created but the emails could not be sent! Contact the TPEN team.
");
}
} else {
- if (request.getParameter("uname") != null){
out.println("
There was an error with your submission. Please check the form and try again.
");
- }
%>
-
<%}%>
diff --git a/web/transcription.jsp b/web/transcription.jsp
index 88289852..5a59a95d 100644
--- a/web/transcription.jsp
+++ b/web/transcription.jsp
@@ -692,7 +692,8 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a64129', end
out.println("nextFolio = \"" + thisProject.getFollowingPage(pageno) + "\";");
}
if (request.getParameter("tool") != null){
- out.println("liveTool = '"+request.getParameter("tool")+"';");
+ // XSS prevent on input
+ out.println("liveTool = '"+ESAPI.encoder().encodeForJavaScript(request.getParameter("tool"))+"';");
}
if (request.getParameter("compareIndex") != null){
out.println("compareIndex = '"+request.getParameter("compareIndex")+"';");
diff --git a/web/uploadHeader.jsp b/web/uploadHeader.jsp
index 5503e080..7d69039d 100644
--- a/web/uploadHeader.jsp
+++ b/web/uploadHeader.jsp
@@ -5,8 +5,7 @@
--%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
+
<%
int UID = 0;
if (session.getAttribute("UID") == null)
@@ -35,9 +34,9 @@ int projectID=0;
JSP Page
-
diff --git a/web/uploadText.jsp b/web/uploadText.jsp
index 2f294956..661fdaa9 100644
--- a/web/uploadText.jsp
+++ b/web/uploadText.jsp
@@ -21,18 +21,25 @@
int projectID=0;
int p=0;
String location = "";
- if(request.getParameter("projectID")!=null)
- {
- if (request.getParameter("p")!=null) p=Integer.parseInt(request.getParameter("p"));
- projectID=Integer.parseInt(request.getParameter("projectID"));
- location = (p>0) ?
- "?projectID="+projectID+"&p="+p :
- "?projectID="+projectID;
- }
- else{
- out.print("no project specified!");
+if (request.getParameter("projectID") == null) {
+ out.print("no project specified!");
+ return;
+}
+try {
+ projectID = Integer.parseInt(request.getParameter("projectID"));
+} catch (NumberFormatException e) {
+ out.print("Invalid project ID!");
+ return;
+}
+if (request.getParameter("p") != null) {
+ try {
+ p = Integer.parseInt(request.getParameter("p"));
+ } catch (NumberFormatException e) {
+ location = "?projectID=" + projectID;
return;
- }
+ }
+}
+location = "?projectID=" + projectID + "&p=" + p;
%>