aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Services
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-23 19:03:25 +0800
committer杨宇千 <crupest@outlook.com>2019-07-23 19:03:25 +0800
commitcccaf4cfdc1b932882768975f409763c22ed1ee1 (patch)
tree572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Services
parente34873c8cec905cd38c754d8968e848c9d0db5c2 (diff)
downloadtimeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.tar.gz
timeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.tar.bz2
timeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.zip
Fix bugs and write unit tests.
Diffstat (limited to 'Timeline/Services')
-rw-r--r--Timeline/Services/JwtService.cs2
-rw-r--r--Timeline/Services/PasswordService.cs2
-rw-r--r--Timeline/Services/UserService.cs4
3 files changed, 4 insertions, 4 deletions
diff --git a/Timeline/Services/JwtService.cs b/Timeline/Services/JwtService.cs
index f721971b..e970bbd4 100644
--- a/Timeline/Services/JwtService.cs
+++ b/Timeline/Services/JwtService.cs
@@ -126,7 +126,7 @@ namespace Timeline.Services
Version = version
};
}
- catch (SecurityTokenException e)
+ catch (Exception e)
{
throw new JwtTokenVerifyException("Validate token failed caused by a SecurityTokenException. See inner exception.", e);
}
diff --git a/Timeline/Services/PasswordService.cs b/Timeline/Services/PasswordService.cs
index 8eab526e..106080f1 100644
--- a/Timeline/Services/PasswordService.cs
+++ b/Timeline/Services/PasswordService.cs
@@ -24,6 +24,8 @@ namespace Timeline.Services
bool VerifyPassword(string hashedPassword, string providedPassword);
}
+ //TODO! Use exceptions!!!
+
/// <summary>
/// Copied from https://github.com/aspnet/AspNetCore/blob/master/src/Identity/Extensions.Core/src/PasswordHasher.cs
/// Remove V2 format and unnecessary format version check.
diff --git a/Timeline/Services/UserService.cs b/Timeline/Services/UserService.cs
index ec8e5091..01d05903 100644
--- a/Timeline/Services/UserService.cs
+++ b/Timeline/Services/UserService.cs
@@ -153,16 +153,14 @@ namespace Timeline.Services
private readonly IJwtService _jwtService;
private readonly IPasswordService _passwordService;
- private readonly IQCloudCosService _cosService;
- public UserService(ILogger<UserService> logger, IMemoryCache memoryCache, DatabaseContext databaseContext, IJwtService jwtService, IPasswordService passwordService, IQCloudCosService cosService)
+ public UserService(ILogger<UserService> logger, IMemoryCache memoryCache, DatabaseContext databaseContext, IJwtService jwtService, IPasswordService passwordService)
{
_logger = logger;
_memoryCache = memoryCache;
_databaseContext = databaseContext;
_jwtService = jwtService;
_passwordService = passwordService;
- _cosService = cosService;
}
private string GenerateCacheKeyByUserId(long id) => $"user:{id}";