Project

General

Profile

« Previous | Next » 

Revision 49657

Added by Sofia Baltzi over 6 years ago

Fix redirect when user does not exist

View differences:

ForgotPasswordServlet.java
56 56
        try {
57 57

  
58 58
            String username = ldapActions.getUsername(formEmail);
59
            if (username == null) {
59
            if (username == null || username.isEmpty()) {
60 60
                request.getSession().setAttribute("message", "User does not exist.");
61 61
                response.sendRedirect("./forgotPassword.jsp");
62 62

  
......
84 84
                String verificationCodeSubject = "Your OpenAIRE password reset request";
85 85

  
86 86
                emailSender.sendEmail(formEmail, verificationCodeSubject, verificationCodeMsg);
87

  
88
                response.setContentType("text/html");
89
                response.sendRedirect("./verify.jsp");
87 90
            }
88 91

  
89 92
        } catch (LDAPException ldape) {
......
94 97
            request.getSession().setAttribute("message", "Error sending email.");
95 98
            response.sendRedirect("./forgotPassword.jsp");
96 99
        }
97

  
98
        response.setContentType("text/html");
99
        response.sendRedirect("./verify.jsp");
100
        
100 101
    }
101 102

  
102 103
}

Also available in: Unified diff