diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp index df36b10..9c3445f 100644 --- a/WebContent/adminLogin.jsp +++ b/WebContent/adminLogin.jsp @@ -28,8 +28,18 @@ <% @@ -140,69 +150,6 @@ if(request.getParameter("login") != null){ /* If the user wants to reset their password, we will keep them on this page. */ -//if(request.getParameter("reset") != null){ - //int ssoNum = Integer.parseInt(request.getParameter("username")); - - /* - Generate new password randomly - */ - //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - //StringBuilder random = new StringBuilder(); - //Random rnd = new Random(); - //String is 16 characters long - //while(random.length() < 16){ - //int index = (int)(rnd.nextFloat()*chars.length()); - //} - //String newpass = random.toString(); - //String hashpass = null; - - /* - Hash new password. - */ - //try { - //MessageDigest md1 = MessageDigest.getInstance("MD5"); - //md1.update(newpass.getBytes()); - //byte[] bytes = md1.digest(); - //StringBuilder sb = new StringBuilder(); - //for(int i = 0; i \ No newline at end of file diff --git a/WebContent/index.jsp b/WebContent/index.jsp index f44d00c..16d5526 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -95,7 +95,7 @@ pageEncoding="ISO-8859-1"%> @@ -103,7 +103,7 @@ pageEncoding="ISO-8859-1"%>

Admin Login

-
+
diff --git a/WebContent/passwordreset.jsp b/WebContent/passwordreset.jsp new file mode 100644 index 0000000..f8f0f78 --- /dev/null +++ b/WebContent/passwordreset.jsp @@ -0,0 +1,147 @@ +<%@ page import = "database.*,entities.User,utilities.Mail" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> +<%@ page import = "java.sql.*" %> +<%@ page import = "java.security.MessageDigest" %> +<%@ page import = "java.security.NoSuchAlgorithmException" %> +<%@ page import = "java.util.Random" %> + + + + + + + + + + + Innovation Hub + + + + + + + + + + + +<% +int success=0; +/* + If the user wants to reset their password, we will keep them on this page. +*/ +if(request.getParameter("reset") != null){ + int ssoNum = Integer.parseInt(request.getParameter("username")); + String email = request.getParameter("email"); + + /* + Generate new password randomly + */ + String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + StringBuilder random = new StringBuilder(); + Random rnd = new Random(); + //String is 16 characters long + while(random.length() < 16){ + int index = (int)(rnd.nextFloat()*chars.length()); + random.append(chars.charAt(index)); + } + String newpass = random.toString(); + String hashpass = null; + + /* + Hash new password. + */ + try { + MessageDigest md1 = MessageDigest.getInstance("MD5"); + md1.update(newpass.getBytes()); + byte[] bytes = md1.digest(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i + + \ No newline at end of file