Revision 49408
Added by Sofia Baltzi over 6 years ago
VerificationCodeServlet.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.openaire.usermanagement; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.openaire.user.utils.VerificationActions; |
4 |
import org.apache.log4j.Logger; |
|
4 | 5 |
import org.springframework.beans.factory.annotation.Autowired; |
5 | 6 |
import org.springframework.web.context.support.SpringBeanAutowiringSupport; |
6 | 7 |
|
8 |
import javax.servlet.RequestDispatcher; |
|
7 | 9 |
import javax.servlet.ServletConfig; |
8 | 10 |
import javax.servlet.ServletException; |
9 | 11 |
import javax.servlet.http.HttpServlet; |
10 | 12 |
import javax.servlet.http.HttpServletRequest; |
11 | 13 |
import javax.servlet.http.HttpServletResponse; |
14 |
import javax.servlet.http.HttpSession; |
|
12 | 15 |
import java.io.IOException; |
13 | 16 |
import java.io.PrintWriter; |
14 | 17 |
|
... | ... | |
26 | 29 |
@Autowired |
27 | 30 |
private VerificationActions verificationActions; |
28 | 31 |
|
32 |
private Logger logger = Logger.getLogger(VerificationCodeServlet.class); |
|
33 |
|
|
29 | 34 |
@Override |
30 | 35 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { |
31 | 36 |
response.setContentType("text/html"); |
... | ... | |
37 | 42 |
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) { |
38 | 43 |
//TODO check expiration date if "now" is more than 24h from the date in DB return error message |
39 | 44 |
//else go to next step resetPassword.jsp |
45 |
// request.setAttribute("username", formUsername); |
|
46 |
// RequestDispatcher rd = getServletContext().getRequestDispatcher("/resetPassword.jsp"); |
|
47 |
// try { |
|
48 |
// rd.forward(request, response); |
|
49 |
// } catch (ServletException e) { |
|
50 |
// logger.info("Dispatcher error" + e); |
|
51 |
// } |
|
52 |
|
|
53 |
HttpSession session = request.getSession(); |
|
54 |
session.setAttribute("username", formUsername); |
|
55 |
|
|
40 | 56 |
response.sendRedirect("./resetPassword.jsp"); |
41 | 57 |
printWriter.close(); |
42 | 58 |
|
Also available in: Unified diff
Add username transfer with session - it workssvn st!