From 1106d9021af2515493132e5ee1bc0d8ffbfe50aa Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Thu, 13 Feb 2020 16:34:06 +0300 Subject: [PATCH] closes volosoft/volo#926 --- .../Volo/Abp/Cli/Commands/SuiteCommand.cs | 20 +++++++++++++------ .../Cli/Licensing/DeveloperApiKeyResult.cs | 10 ++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index a47a865617..a13621ea22 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.Cli.Commands private async Task InstallSuiteAsync() { var nugetIndexUrl = await GetNuGetIndexUrlAsync(); - + if (nugetIndexUrl == null) { return; @@ -108,13 +108,21 @@ namespace Volo.Abp.Cli.Commands { var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); - if (apiKeyResult == null || string.IsNullOrEmpty(apiKeyResult.ApiKey)) + if (apiKeyResult == null) + { + Logger.LogWarning("You are not signed in! Use the CLI command \"abp login \" to sign in, then try again."); + return null; + } + + if (!string.IsNullOrWhiteSpace(apiKeyResult.ErrorMessage)) { - Logger.LogError("Couldn't retrieve your NuGet API key!"); - Logger.LogWarning(File.Exists(CliPaths.AccessToken) - ? "Make sure you have an active session and license on commercial.abp.io. To re-sign in you can use the CLI command \"abp login \"." - : "You are not signed in to commercial.abp.io. Use the CLI command \"abp login \" to sign in."); + Logger.LogWarning(apiKeyResult.ErrorMessage); + return null; + } + if (string.IsNullOrEmpty(apiKeyResult.ApiKey)) + { + Logger.LogError("Couldn't retrieve your NuGet API key! You can re-sign in with the CLI command \"abp login \"."); return null; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs index fb3622f6eb..eb781c27b1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs @@ -10,5 +10,15 @@ namespace Volo.Abp.Cli.Licensing public DateTime? LicenseEndTime { get; set; } public bool CanDownloadSourceCode { get; set; } public string LicenseCode { get; set; } + public string ErrorMessage { get; set; } + public LicenseErrorType? ErrorType { get; set; } + + public enum LicenseErrorType + { + NotAuthenticated = 1, + NotMemberOfAnOrganization = 2, + NoActiveLicense = 3, + NotDeveloperOfTheOrganization = 4 + } } } \ No newline at end of file