List of usage examples for com.liferay.portal.kernel.util WebKeys FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS
String FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS
To view the source code for com.liferay.portal.kernel.util WebKeys FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS.
Click Source Link
From source file:com.liferay.login.web.internal.portlet.action.ForgotPasswordMVCActionCommand.java
License:Open Source License
protected void checkReminderQueries(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { PortletSession portletSession = actionRequest.getPortletSession(); int step = ParamUtil.getInteger(actionRequest, "step"); if (step == 1) { checkCaptcha(actionRequest);/*w w w .ja v a2 s . c om*/ portletSession.removeAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_ATTEMPTS); portletSession.removeAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS); } User user = getUser(actionRequest); portletSession.setAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS, user.getEmailAddress()); actionRequest.setAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_USER, user); if (step == 2) { Integer reminderAttempts = (Integer) portletSession .getAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_ATTEMPTS); if (reminderAttempts == null) { reminderAttempts = 0; } else if (reminderAttempts > 2) { checkCaptcha(actionRequest); } reminderAttempts++; portletSession.setAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_ATTEMPTS, reminderAttempts); sendPassword(actionRequest, actionResponse); } }
From source file:com.liferay.login.web.internal.portlet.action.ForgotPasswordMVCActionCommand.java
License:Open Source License
protected User getUser(ActionRequest actionRequest) throws Exception { PortletSession portletSession = actionRequest.getPortletSession(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String sessionEmailAddress = (String) portletSession .getAttribute(WebKeys.FORGOT_PASSWORD_REMINDER_USER_EMAIL_ADDRESS); User user = null;/*from w w w. j av a2 s .c om*/ if (Validator.isNotNull(sessionEmailAddress)) { user = _userLocalService.getUserByEmailAddress(themeDisplay.getCompanyId(), sessionEmailAddress); } else { long userId = ParamUtil.getLong(actionRequest, "userId"); String screenName = ParamUtil.getString(actionRequest, "screenName"); String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); if (Validator.isNotNull(emailAddress)) { user = _userLocalService.getUserByEmailAddress(themeDisplay.getCompanyId(), emailAddress); } else if (Validator.isNotNull(screenName)) { user = _userLocalService.getUserByScreenName(themeDisplay.getCompanyId(), screenName); } else if (userId > 0) { user = _userLocalService.getUserById(userId); } else { throw new NoSuchUserException("User does not exist"); } } if (!user.isActive()) { throw new UserActiveException("Inactive user " + user.getUuid()); } _userLocalService.checkLockout(user); return user; }