feat: добавил отображение аватарки
This commit is contained in:
1 parent
34e450815b
commit
038f0d89a6
22 files changed
+598
-28
No files matched your search
@@ -108,6 +108,18 @@ public class AuthService : IAuthService
|
||||
await _db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(user.AvatarUrl))
|
||||
await _microsoftAuth.SaveTokenCacheAsync(user.Id, result);
|
||||
else
|
||||
await _microsoftAuth.RemoveTokenCacheAsync(user.Id);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.Security.Cryptography.CryptographicException)
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not save Microsoft token cache for user {UserId}.", user.Id);
|
||||
}
|
||||
|
||||
var accessToken = GenerateAccessToken(user);
|
||||
var refreshToken = await GenerateRefreshTokenAsync(user.Id);
|
||||
await TrySendLoginNotificationAsync(user, ipAddress);
|
||||
@@ -215,6 +227,18 @@ public class AuthService : IAuthService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RemoveMicrosoftTokenCacheAsync(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _microsoftAuth.RemoveTokenCacheAsync(userId);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not remove Microsoft token cache for user {UserId}.", userId);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<CurrentUserDto> GetCurrentUserAsync(int userId)
|
||||
{
|
||||
var user = await _db.Users
|
||||
|
||||
Reference in new issue
Block a user