1
0
Форкнуть 0

Make askpass actually work for SSH.

This commit is contained in:
J Wyman 2016-09-26 16:05:34 -04:00
Родитель b0928c83d6
Коммит 145037b9a9
4 изменённых файлов: 23 добавлений и 8 удалений

Просмотреть файл

@ -266,7 +266,15 @@
Grid.Column="1"
Grid.Row="0"
HorizontalContentAlignment="Left">
<TextBlock Text="{Binding Path=Resource}"/>
<ScrollViewer BorderThickness="0"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
HorizontalScrollBarVisibility="Hidden"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
VerticalScrollBarVisibility="Disabled">
<TextBlock Text="{Binding Path=Resource}"/>
</ScrollViewer>
</Label>
</Grid.Children>
</Grid>
@ -274,7 +282,8 @@
Grid.Row="2"
Style="{StaticResource PassphraseBorderStyle}">
<PasswordBox x:Name="PassphrasePasswordBox"
TabIndex="0"/>
Focusable="True"
TabIndex="0"/>
</Border>
<Button x:Name="LearnMoreLink"
Grid.Column="3"

Просмотреть файл

@ -76,6 +76,7 @@ namespace Microsoft.Alm.Gui
protected void CancelButton_Click(object sender, RoutedEventArgs e)
{
Failure();
Close();
}
protected void MoreInfoLabel_Click(object sender, RoutedEventArgs e)
@ -90,6 +91,7 @@ namespace Microsoft.Alm.Gui
protected void OkButton_Click(object sender, RoutedEventArgs e)
{
Success();
Close();
}
private void Failure()

Просмотреть файл

@ -34,6 +34,8 @@ namespace Microsoft.Alm.Gui
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
adornerLayer?.Add(this);
IsHitTestVisible = false;
}
public object Content

Просмотреть файл

@ -14,8 +14,9 @@ namespace Microsoft.Alm.Cli
public const string Description = "Secure SSH key helper for Windows, by Microsoft";
public const string DefinitionUrlPassphrase = "https://www.visualstudio.com/docs/git/gcm-ssh-passphrase";
private static readonly Regex AskCredentialRegex = new Regex(@"\s+(\S+)\s+for\s+'([^']+)':\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex AskPassphraseRegex = new Regex(@"\s+Enter\s+passphrase\s+for\s+key\s+'([^']+)':\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex AskCredentialRegex = new Regex(@"\s*(\S+)\s+for\s+'([^']+)':\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex AskPassphraseRegex = new Regex(@"\s*\""Enter\s+passphrase\s+for\s+key\s+'([^']+)':\s+\""\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex AskPasswordRegex = new Regex(@"\s*\""([^']+)'s\s+password:\s+\""\s*$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static void Askpass()
{
@ -115,7 +116,8 @@ namespace Microsoft.Alm.Cli
Git.Trace.WriteLine("unable to parse URL.");
}
}
else if ((match = AskPassphraseRegex.Match(Environment.CommandLine)).Success)
else if ((match = AskPasswordRegex.Match(Environment.CommandLine)).Success
|| (match = AskPassphraseRegex.Match(Environment.CommandLine)).Success)
{
Git.Trace.WriteLine("querying for passphrase key.");
@ -150,10 +152,10 @@ namespace Microsoft.Alm.Cli
{
EnableDebugTrace();
if (args.Length == 0
|| String.Equals(args[0], "--help", StringComparison.OrdinalIgnoreCase)
if (args.Length > 0
&& (String.Equals(args[0], "--help", StringComparison.OrdinalIgnoreCase)
|| String.Equals(args[0], "-h", StringComparison.OrdinalIgnoreCase)
|| args[0].Contains('?'))
|| args[0].Contains('?')))
{
PrintHelpMessage();
return;