Skip to content
Snippets Groups Projects
Commit 5e5aec23 authored by Mike McKay's avatar Mike McKay
Browse files

Prevented guest user from getting locked out due to inactivity or invalid logins.

parent 78422a10
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,8 @@ public class DisableInactiveUsers implements Runnable { ...@@ -64,7 +64,8 @@ public class DisableInactiveUsers implements Runnable {
final UserI u = Users.getUser(username); final UserI u = Users.getUser(username);
// Fixes XNAT-2407. Only disable user if they have not been recently modified (enabled). // Fixes XNAT-2407. Only disable user if they have not been recently modified (enabled).
if (!hasUserBeenModified(u, _inactivityBeforeLockout)) { // Also do not disable the guest user.
if (!hasUserBeenModified(u, _inactivityBeforeLockout) && !username.equals("guest")) {
u.setEnabled("0"); u.setEnabled("0");
u.setVerified("0"); u.setVerified("0");
Users.save(u, adminUser, false, EventUtils.newEventInstance(EventUtils.CATEGORY.SIDE_ADMIN, EventUtils.TYPE.PROCESS, "Disabled due to inactivity")); Users.save(u, adminUser, false, EventUtils.newEventInstance(EventUtils.CATEGORY.SIDE_ADMIN, EventUtils.TYPE.PROCESS, "Disabled due to inactivity"));
......
...@@ -332,7 +332,7 @@ public class XnatProviderManager extends ProviderManager { ...@@ -332,7 +332,7 @@ public class XnatProviderManager extends ProviderManager {
*/ */
private synchronized void addFailedLoginAttempt(final Authentication auth) throws SiteConfigurationException { private synchronized void addFailedLoginAttempt(final Authentication auth) throws SiteConfigurationException {
XdatUserAuth ua = _manager.getUserByAuth(auth); XdatUserAuth ua = _manager.getUserByAuth(auth);
if (ua != null) { if (ua != null && !ua.getXdatUsername().equals("guest")) {
if (XDAT.getSiteConfigPreferences().getMaxFailedLogins() > 0) { if (XDAT.getSiteConfigPreferences().getMaxFailedLogins() > 0) {
ua.setFailedLoginAttempts(ua.getFailedLoginAttempts() + 1); ua.setFailedLoginAttempts(ua.getFailedLoginAttempts() + 1);
ua.setLastLoginAttempt(new Date()); ua.setLastLoginAttempt(new Date());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment