use of com.liferay.portal.kernel.model.User in project liferay-blade-samples by liferay.
the class UsersRestService method getUsers.
@GET
@Path("/list")
@Produces("text/plain")
public String getUsers() {
StringBuilder result = new StringBuilder();
for (User user : _userLocalService.getUsers(-1, -1)) {
result.append(user.getFullName());
result.append(",\n");
}
return result.toString();
}
use of com.liferay.portal.kernel.model.User in project liferay-blade-samples by liferay.
the class LogAuthFailure method onFailureByEmailAddress.
@Override
public void onFailureByEmailAddress(long companyId, String emailAddress, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException {
try {
User user = UserLocalServiceUtil.getUserByEmailAddress(companyId, emailAddress);
int failures = user.getFailedLoginAttempts();
_log.log(LogService.LOG_INFO, "onFailureByEmailAddress: " + emailAddress + " has failed to login " + failures + " times");
} catch (PortalException pe) {
_log.log(LogService.LOG_ERROR, pe.getMessage(), pe);
}
}
use of com.liferay.portal.kernel.model.User in project liferay-blade-samples by liferay.
the class LogMaxFailures method onFailureByEmailAddress.
@Override
public void onFailureByEmailAddress(long companyId, String emailAddress, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException {
try {
User user = UserLocalServiceUtil.getUserByEmailAddress(companyId, emailAddress);
boolean lockout = user.isLockout();
_log.log(LogService.LOG_INFO, "onFailureByEmailAddress: " + emailAddress + " is " + (lockout ? "" : "not") + " locked out.");
} catch (PortalException pe) {
_log.log(LogService.LOG_ERROR, pe.getMessage(), pe);
}
}
use of com.liferay.portal.kernel.model.User in project liferay-blade-samples by liferay.
the class LogMaxFailures method onFailureByUserId.
@Override
public void onFailureByUserId(long companyId, long userId, Map<String, String[]> headerMap, Map<String, String[]> parameterMap) throws AuthException {
try {
User user = UserLocalServiceUtil.getUserById(userId);
boolean lockout = user.isLockout();
_log.log(LogService.LOG_INFO, "onFailureById: userId " + userId + " is " + (lockout ? "" : "not") + " locked out.");
} catch (PortalException pe) {
_log.log(LogService.LOG_ERROR, pe.getMessage(), pe);
}
}
use of com.liferay.portal.kernel.model.User in project liferay-blade-samples by liferay.
the class BladeAutoLogin method doLogin.
@Override
protected String[] doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception {
String[] credentials = null;
long companyId = PortalUtil.getCompanyId(request);
User autoLoginUser = null;
try {
autoLoginUser = _userLocalService.getUserByEmailAddress(companyId, "auto.login@liferay.com");
} catch (Exception e) {
}
if (autoLoginUser != null) {
credentials = new String[3];
credentials[0] = Long.toString(autoLoginUser.getUserId());
credentials[1] = autoLoginUser.getPassword();
credentials[2] = Boolean.toString(true);
}
_log.log(LogService.LOG_INFO, "Logged in as" + autoLoginUser.getFullName() + "by Blade Auto Login");
return credentials;
}
Aggregations