Example usage for com.liferay.portal.kernel.model Company isSendPassword

List of usage examples for com.liferay.portal.kernel.model Company isSendPassword

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model Company isSendPassword.

Prototype

@Deprecated
public boolean isSendPassword();

Source Link

Usage

From source file:com.liferay.login.extension.ForgotPasswordExtensionMVCRenderCommand.java

License:Open Source License

@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {

    System.out.println("ForgotPassword Render Command Override....");

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
        return "/login.jsp";
    }/* ww w .  jav a  2  s .  c o m*/

    renderResponse.setTitle(themeDisplay.translate("forgot-password"));

    return "/forgot_password.jsp";
}

From source file:com.liferay.login.web.internal.portlet.action.ForgotPasswordMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
        throw new PrincipalException.MustBeEnabled(company.getCompanyId(),
                PropsKeys.COMPANY_SECURITY_SEND_PASSWORD, PropsKeys.COMPANY_SECURITY_SEND_PASSWORD_RESET_LINK);
    }//w  w  w.ja v  a 2  s .  c  o  m

    try {
        if (PropsValues.USERS_REMINDER_QUERIES_ENABLED) {
            checkReminderQueries(actionRequest, actionResponse);
        } else {
            checkCaptcha(actionRequest);

            sendPassword(actionRequest, actionResponse);
        }
    } catch (Exception e) {
        if (e instanceof CaptchaConfigurationException || e instanceof CaptchaTextException
                || e instanceof UserEmailAddressException) {

            SessionErrors.add(actionRequest, e.getClass());
        } else if (e instanceof NoSuchUserException || e instanceof RequiredReminderQueryException
                || e instanceof SendPasswordException || e instanceof UserActiveException
                || e instanceof UserLockoutException || e instanceof UserReminderQueryException) {

            if (PropsValues.LOGIN_SECURE_FORGOT_PASSWORD) {
                sendRedirect(actionRequest, actionResponse, null);
            } else {
                SessionErrors.add(actionRequest, e.getClass(), e);
            }
        } else {
            _portal.sendError(e, actionRequest, actionResponse);
        }
    }
}

From source file:com.liferay.login.web.internal.portlet.action.ForgotPasswordMVCRenderCommand.java

License:Apache License

@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) {

    System.out.println("In " + getClass().getName() + " render");

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
        return "/login.jsp";
    }/*from   w  w w .  j a  v  a2 s  . c o m*/

    renderResponse.setTitle(themeDisplay.translate("forgot-password"));

    return "/forgot_password.jsp";
}

From source file:com.liferay.login.web.internal.portlet.util.LoginUtil.java

License:Open Source License

public static void sendPassword(ActionRequest actionRequest, String fromName, String fromAddress,
        String toAddress, String subject, String body) throws Exception {

    HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
        return;//w ww  .ja v a  2 s .  co m
    }

    ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);

    UserLocalServiceUtil.sendPassword(company.getCompanyId(), toAddress, fromName, fromAddress, subject, body,
            serviceContext);
}

From source file:com.liferay.login.web.internal.servlet.taglib.include.ForgetPasswordNavigationPostPageInclude.java

License:Open Source License

@Override
public void include(PageContext pageContext) throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String mvcRenderCommandName = request.getParameter("mvcRenderCommandName");

    if ("/login/forgot_password".equals(mvcRenderCommandName)) {
        return;//from   ww w .  j  a va 2s.co m
    }

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
        return;
    }

    RenderURLTag renderURLTag = new RenderURLTag();

    renderURLTag.setPageContext(pageContext);

    renderURLTag.addParam("mvcRenderCommandName", "/login/forgot_password");
    renderURLTag.setVar("forgotPasswordURL");
    renderURLTag.setWindowState(WindowState.MAXIMIZED.toString());

    renderURLTag.doTag(pageContext);

    String forgetPasswordURL = (String) pageContext.getAttribute("forgotPasswordURL");

    IconTag iconTag = new IconTag();

    iconTag.setIconCssClass("icon-question-sign");
    iconTag.setMessage("forgot-password");
    iconTag.setUrl(forgetPasswordURL);

    iconTag.doTag(pageContext);
}