Page 1 of 1

What is "errorCode" in Forgot Password Process

Posted: Tue May 07, 2013 8:41 pm
by soeyannaing
I found some codes below in "BroadleafLoginController.java" :

String errorCode = errorResponse.getErrorCodesList().get(0);
request.setAttribute("errorCode", errorCode);
return getResetPasswordView();

In this codes, what is that "errorCode" for ? And how to use this "errorCode" ?
I didn't find any place in broadleaf that is using "errorCode".
I need to show Error message in Forgot Password Page, but i don't know this "errorCode" how to use it.

Thanks in Advance.

Re: What is "errorCode" in Forgot Password Process

Posted: Wed May 22, 2013 10:52 am
by jfridye
BroadleafLoginController executes sendForgotPasswordNotification() in CustomerService, which will add an 'errorCode' to the response. The template in the Heat Clinic demo (forgotPassword.html) checks to see if there is an error, then given the code will print out the corresponding error message. Here are the relevant lines of code in the template:

Code: Select all

        <span class="error" th:switch="${errorCode}" th:if="${errorCode}">
            <p th:case="'invalidCustomer'">No matching email found.</p>
            <p th:case="'inactiveCustomer'">The email you entered is marked as inactive.   Please contact an administrator to activate your account.</p>
            <p th:case="*">Unknown error.</p>
        </span>


Hope this helps!