protected internal virtual IdentityOperationResult unlockUser(UserEntity user) { if (user.Attempts > 0 || user.LockExpirationTime != null) { IdentityInfoManager.updateUserLock(user, 0, null); return(new IdentityOperationResult(user, IdentityOperationResult.OPERATION_UNLOCK)); } return(new IdentityOperationResult(user, IdentityOperationResult.OPERATION_NONE)); }
protected internal virtual void lockUser(UserEntity user) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration; int max = processEngineConfiguration.LoginDelayMaxTime; int baseTime = processEngineConfiguration.LoginDelayBase; int factor = processEngineConfiguration.LoginDelayFactor; int attempts = user.Attempts + 1; long delay = (long)(baseTime * Math.Pow(factor, attempts - 1)); delay = Math.Min(delay, max) * 1000; long currentTime = ClockUtil.CurrentTime.Ticks; DateTime lockExpirationTime = new DateTime(currentTime + delay); IdentityInfoManager.updateUserLock(user, attempts, lockExpirationTime); }