Example #1
0
        public async Task <Status> RemovePasswordHashAsync(string uniqueIdentifier)
        {
            _logger.LogTrace("Remove password hash");
            var count  = 1;
            var record = await _context.PasswordHashes.FindAsync(uniqueIdentifier);

            if (record != null)
            {
                _context.Remove(record);
                count = await _context.SaveChangesAsync();
            }
            if (count == 0)
            {
                return(Status.Error(_localizer["Password not removed."]));
            }

            return(Status.Success(_localizer["Password removed."]));
        }
Example #2
0
        public async Task <Status> RemoveOneTimeCodeAsync(string sentTo)
        {
            _logger.LogTrace("Removing one time code for {0}", sentTo);
            var count  = 1;
            var record = await _context.OneTimeCodes.FindAsync(sentTo);

            if (record != null)
            {
                _context.Remove(record);
                count = await _context.SaveChangesAsync();
            }
            if (count == 0)
            {
                return(Status.Error(_localizer["One time code was not removed."]));
            }

            return(Status.Success(_localizer["One time code was removed."]));
        }
        public async Task <Status> RemoveTrustedBrowserAsync(string subjectId, int recordId)
        {
            _logger.LogDebug("Removing an trusted browser.");

            var dbBrowser = await _context.TrustedBrowsers.FindAsync(recordId);

            if (dbBrowser == null || dbBrowser.SubjectId != subjectId)
            {
                _logger.LogDebug("Trusted browser not found or it did not belong to this user.");
                return(Status.Error(_localizer["Trusted browser not found or it did not belong to this user."]));
            }
            _context.Remove(dbBrowser);
            var count = await _context.SaveChangesAsync();

            var success = count > 0;

            _logger.LogDebug("Trusted browser successfully removed.");
            return(Status.Success(_localizer["Trusted browser successfully removed."]));
        }