Skip to content

Commit ad51861

Browse files
committed
bitbucket: reimplement credential and OAuth views
Reimplement WPF views for the Bitbucket credential and OAuth prompts. The layout is largely unchanged, but now more closely matches the Avalonia layout/implementation of these views.
1 parent 4e1d076 commit ad51861

File tree

5 files changed

+137
-4
lines changed

5 files changed

+137
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
<ResourceDictionary.MergedDictionaries>
4+
<ResourceDictionary Source="pack://application:,,,/Microsoft.Git.CredentialManager.UI.Windows;component/Assets/Styles.xaml"/>
5+
</ResourceDictionary.MergedDictionaries>
6+
</ResourceDictionary>

src/windows/Atlassian.Bitbucket.UI.Windows/Views/CredentialsView.xaml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,60 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
mc:Ignorable="d">
6+
xmlns:viewModels="clr-namespace:Atlassian.Bitbucket.UI.ViewModels;assembly=Atlassian.Bitbucket.UI.Shared"
7+
xmlns:sharedControls="clr-namespace:Microsoft.Git.CredentialManager.UI.Controls;assembly=Microsoft.Git.CredentialManager.UI.Windows"
8+
mc:Ignorable="d"
9+
d:DataContext="{d:DesignInstance viewModels:CredentialsViewModel}"
10+
d:DesignWidth="300">
11+
<UserControl.Resources>
12+
<ResourceDictionary>
13+
<ResourceDictionary.MergedDictionaries>
14+
<ResourceDictionary Source="../Assets/Styles.xaml"/>
15+
</ResourceDictionary.MergedDictionaries>
16+
</ResourceDictionary>
17+
</UserControl.Resources>
18+
<DockPanel LastChildFill="True">
19+
<StackPanel DockPanel.Dock="Bottom">
20+
<TextBlock Margin="0,30,0,10"
21+
FontSize="14" TextAlignment="Center">
22+
<Hyperlink Command="{Binding ForgotPasswordCommand}">
23+
Can't log in?
24+
</Hyperlink>
25+
</TextBlock>
26+
<TextBlock Margin="0,0,0,10"
27+
FontSize="14" TextAlignment="Center">
28+
<Hyperlink Command="{Binding SignUpCommand}">
29+
Sign up for an account
30+
</Hyperlink>
31+
</TextBlock>
32+
</StackPanel>
33+
34+
<StackPanel DockPanel.Dock="Top" Margin="0,0,0,30">
35+
<Image HorizontalAlignment="Center" Source="/Assets/atlassian-logo.png" />
36+
<TextBlock HorizontalAlignment="Center"
37+
FontSize="14"
38+
Text="Log in to your account"/>
39+
</StackPanel>
40+
41+
<StackPanel Width="288">
42+
<sharedControls:PromptTextBox x:Name="userNameTextBox"
43+
Margin="0,0,0,10"
44+
HorizontalAlignment="Stretch"
45+
PromptText="Email or username"
46+
Text="{Binding UserName}" />
47+
<sharedControls:PasswordPromptTextBox x:Name="passwordTextBox"
48+
Margin="0,0,0,20"
49+
HorizontalAlignment="Stretch"
50+
PromptText="Password"
51+
Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Delay=300, Mode=OneWayToSource}" />
52+
<Button IsDefault="True"
53+
HorizontalAlignment="Center"
54+
HorizontalContentAlignment="Center"
55+
VerticalContentAlignment="Center"
56+
Command="{Binding LoginCommand}"
57+
Content="Continue"
58+
Width="140" Height="40"
59+
Style="{StaticResource AccentButton}"/>
60+
</StackPanel>
61+
</DockPanel>
762
</UserControl>
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
using System.Windows.Controls;
2+
using Atlassian.Bitbucket.UI.ViewModels;
3+
using Microsoft.Git.CredentialManager.UI.Controls;
24

35
namespace Atlassian.Bitbucket.UI.Views
46
{
5-
public partial class CredentialsView : UserControl
7+
public partial class CredentialsView : UserControl, IFocusable
68
{
79
public CredentialsView()
810
{
911
InitializeComponent();
1012
}
13+
14+
public void SetFocus()
15+
{
16+
if (!(DataContext is CredentialsViewModel vm))
17+
{
18+
return;
19+
}
20+
21+
if (string.IsNullOrWhiteSpace(vm.UserName))
22+
{
23+
userNameTextBox.Focus();
24+
}
25+
else
26+
{
27+
passwordTextBox.Focus();
28+
}
29+
}
1130
}
1231
}

src/windows/Atlassian.Bitbucket.UI.Windows/Views/OAuthView.xaml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,52 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
mc:Ignorable="d">
6+
xmlns:viewModels="clr-namespace:Atlassian.Bitbucket.UI.ViewModels;assembly=Atlassian.Bitbucket.UI.Shared"
7+
mc:Ignorable="d"
8+
d:DataContext="{d:DesignInstance viewModels:OAuthViewModel}"
9+
d:DesignWidth="300">
10+
<UserControl.Resources>
11+
<ResourceDictionary>
12+
<ResourceDictionary.MergedDictionaries>
13+
<ResourceDictionary Source="../Assets/Styles.xaml"/>
14+
</ResourceDictionary.MergedDictionaries>
15+
</ResourceDictionary>
16+
</UserControl.Resources>
17+
<DockPanel LastChildFill="True">
18+
<StackPanel DockPanel.Dock="Bottom">
19+
<TextBlock Margin="0,30,0,10"
20+
FontSize="14" TextAlignment="Center">
21+
<Hyperlink Command="{Binding ForgotPasswordCommand}">
22+
Can't log in?
23+
</Hyperlink>
24+
</TextBlock>
25+
<TextBlock Margin="0,0,0,10"
26+
FontSize="14" TextAlignment="Center">
27+
<Hyperlink Command="{Binding SignUpCommand}">
28+
Sign up for an account
29+
</Hyperlink>
30+
</TextBlock>
31+
</StackPanel>
32+
33+
<StackPanel DockPanel.Dock="Top">
34+
<Image HorizontalAlignment="Center" Source="/Assets/atlassian-logo.png" />
35+
<TextBlock HorizontalAlignment="Center"
36+
FontSize="14"
37+
Text="OAuth Authentication"/>
38+
</StackPanel>
39+
40+
<StackPanel Width="288">
41+
<TextBlock Margin="0,44,0,30"
42+
FontSize="14" TextAlignment="Center">
43+
<Hyperlink Command="{Binding LearnMoreCommand}">
44+
Learn more about 2-Factor Authentication
45+
</Hyperlink>
46+
</TextBlock>
47+
<Button IsDefault="True" x:Name="okButton"
48+
HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
49+
Command="{Binding OkCommand}"
50+
Content="Authorize" Width="140" Height="40"
51+
Style="{StaticResource AccentButton}"/>
52+
</StackPanel>
53+
</DockPanel>
754
</UserControl>
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
using System.Windows.Controls;
2+
using Microsoft.Git.CredentialManager.UI.Controls;
23

34
namespace Atlassian.Bitbucket.UI.Views
45
{
5-
public partial class OAuthView : UserControl
6+
public partial class OAuthView : UserControl, IFocusable
67
{
78
public OAuthView()
89
{
910
InitializeComponent();
1011
}
12+
13+
public void SetFocus()
14+
{
15+
okButton.Focus();
16+
}
1117
}
1218
}

0 commit comments

Comments
 (0)