|
|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Volo.Abp.Cli.Args;
|
|
|
|
|
using Volo.Abp.Cli.Auth;
|
|
|
|
|
using Volo.Abp.Cli.Utils;
|
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.Cli.Commands
|
|
|
|
|
@ -24,8 +25,33 @@ namespace Volo.Abp.Cli.Commands
|
|
|
|
|
{
|
|
|
|
|
if (commandLineArgs.Target.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
Logger.LogWarning("Username is missing.");
|
|
|
|
|
LogHelp();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Console.Write("Password: ");
|
|
|
|
|
var password = ConsoleHelper.ReadSecret();
|
|
|
|
|
if (password.IsNullOrWhiteSpace())
|
|
|
|
|
{
|
|
|
|
|
Logger.LogWarning("Password is missing.");
|
|
|
|
|
LogHelp();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await AuthService.LoginAsync(commandLineArgs.Target, password);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine($"Successfully logged in as '{commandLineArgs.Target}'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LogHelp()
|
|
|
|
|
{
|
|
|
|
|
Logger.LogWarning("");
|
|
|
|
|
Logger.LogWarning("Usage:");
|
|
|
|
|
Logger.LogWarning(" abp login <username>");
|
|
|
|
|
Logger.LogWarning("");
|
|
|
|
|
Logger.LogWarning("Example:");
|
|
|
|
|
Logger.LogWarning(" abp login john");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|