refactor: clean code

This commit is contained in:
2024-12-22 07:25:41 +03:00
parent b82fbc491f
commit 3e05863aea
3 changed files with 8 additions and 9 deletions

View File

@ -75,7 +75,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
if (userId != null)
{
userEntity.OAuthProviders ??= new Dictionary<OAuthProvider, OAuthUser>();
userEntity.OAuthProviders ??= [];
if (!userEntity.OAuthProviders.TryAdd(provider, oAuthUser))
{
@ -105,7 +105,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
TwoFactorAuthenticator = userEntity.TwoFactorAuthenticator,
SecondFactorToken = userEntity.Secret,
OAuthProviders = userEntity.OAuthProviders
}, provider);
});
title = "Успешный вход в аккаунт.";
message = "Вы успешно вошли в свою учетную запись. Добро пожаловать!";
@ -152,7 +152,7 @@ public class AuthController(IOptionsSnapshot<Admin> user, IOptionsSnapshot<Gener
[MaintenanceModeIgnore]
public ActionResult<List<AvailableOAuthProvidersResponse>> AvailableProviders() =>
Ok(oAuthService
.GetAvailableProviders(HttpContext, HttpContext.GetApiUrl(Url.Action("AuthorizeOAuth2")!))
.GetAvailableProviders(HttpContext.GetApiUrl(Url.Action("AuthorizeOAuth2")!))
.ConvertToDto());
/// <summary>