コード例 #1
0
        public void LogSuccess(LoginRequest request, Audit audit)
        {
            _session.Store(audit);

            var history = _session.Load<LoginFailureHistory>(request.UserName);
            if (history != null)
            {
                _session.Delete(history);
            }
        }
コード例 #2
0
        public void LogFailure(LoginRequest request, Audit audit)
        {
            if (request.UserName.IsEmpty()) return;

            _session.Store(audit);

            var history = _session.Load<LoginFailureHistory>(request.UserName) ?? new LoginFailureHistory
            {
                Id = request.UserName
            };

            history.Attempts = request.NumberOfTries;
            history.LockedOutTime = request.LockedOutUntil;

            _session.Store(history);
        }