001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.login.action;
016    
017    import com.liferay.portal.kernel.portlet.bridges.mvc.MVCRenderCommand;
018    import com.liferay.portal.kernel.spring.osgi.OSGiBeanProperties;
019    import com.liferay.portal.model.Company;
020    import com.liferay.portal.theme.ThemeDisplay;
021    import com.liferay.portal.util.PortletKeys;
022    import com.liferay.portal.util.WebKeys;
023    
024    import javax.portlet.RenderRequest;
025    import javax.portlet.RenderResponse;
026    
027    /**
028     * @author Peter Fellwock
029     */
030    @OSGiBeanProperties(
031            property = {
032                    "javax.portlet.name=" + PortletKeys.FAST_LOGIN,
033                    "javax.portlet.name=" + PortletKeys.LOGIN,
034                    "mvc.command.name=/login/forgot_password"
035            }
036    )
037    public class ForgotPasswordMVCRenderCommand implements MVCRenderCommand {
038    
039            @Override
040            public String render(
041                    RenderRequest renderRequest, RenderResponse renderResponse) {
042    
043                    ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(
044                            WebKeys.THEME_DISPLAY);
045    
046                    Company company = themeDisplay.getCompany();
047    
048                    if (!company.isSendPassword() && !company.isSendPasswordResetLink()) {
049                            return "/html/portlet/login/login.jsp";
050                    }
051    
052                    renderResponse.setTitle(themeDisplay.translate("forgot-password"));
053    
054                    return "/html/portlet/login/forgot_password.jsp";
055            }
056    
057    }