List of usage examples for com.liferay.portal.kernel.exception UserActiveException UserActiveException
public UserActiveException(Throwable cause)
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;// ww w . ja v a 2 s . c o m 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; }