Skip to content

Commit

Permalink
Fix: tried to hide the password from user (failed)
Browse files Browse the repository at this point in the history
  • Loading branch information
sulaimanfawwazak committed Nov 25, 2024
1 parent 64e9db2 commit f473d1d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 12 deletions.
9 changes: 8 additions & 1 deletion Appview/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
xmlns:local="clr-namespace:Appview"
StartupUri="MainWindow.xaml">
<Application.Resources>

<Style TargetType="TextBlock">
<!--<Setter Property="FontFamily" Value="pack://application:,,,/Appview;component/Fonts/#Parkinsans"/>-->
<Setter Property="FontFamily" Value="pack://application:,,,/Appview;component/Fonts/#Poppins"/>
</Style>
<Style TargetType="TextBox">
<!--<Setter Property="FontFamily" Value="pack://application:,,,/Appview;component/Fonts/#Parkinsans"/>-->
<Setter Property="FontFamily" Value="pack://application:,,,/Appview;component/Fonts/#Poppins"/>
</Style>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions Appview/Appview.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<Page Remove="ViewModels\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Fonts\Parkinsans-VariableFont_wght.ttf" />
<None Remove="Fonts\Poppins-Bold.ttf" />
<None Remove="Fonts\Poppins-Regular.ttf" />
</ItemGroup>

<ItemGroup>
<Content Include="take-away 1.ico" />
</ItemGroup>
Expand All @@ -26,4 +32,10 @@
<PackageReference Include="Npgsql" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\Parkinsans-VariableFont_wght.ttf" />
<Resource Include="Fonts\Poppins-Bold.ttf" />
<Resource Include="Fonts\Poppins-Regular.ttf" />
</ItemGroup>

</Project>
Binary file added Appview/Fonts/Parkinsans-VariableFont_wght.ttf
Binary file not shown.
Binary file added Appview/Fonts/Poppins-Bold.ttf
Binary file not shown.
Binary file added Appview/Fonts/Poppins-Regular.ttf
Binary file not shown.
10 changes: 6 additions & 4 deletions Appview/Views/Login.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@
</Border>

<!-- Password Form -->
<Border BorderBrush="white" BorderThickness="4" CornerRadius="5" Padding="1" Margin="1" Width="308">
<TextBox x:Name="txtPassword" Width="300" Height="45" Background="#FE8501" Foreground="Black"
FontSize="16" FontWeight="SemiBold"
local:Placeholder.Placeholder="Password" VerticalContentAlignment="Center"/>
<Border BorderBrush="white" BorderThickness="4" CornerRadius="5" Padding="1" Margin="0, 10, 0, 0" Width="308">
<StackPanel>
<!--<TextBox x:Name="txtPasswordPlaceholder" Text="Password" Background="DarkOrange" Foreground="White" BorderThickness="1" BorderBrush="White" Padding="5" IsReadOnly="True" HorizontalContentAlignment="Left" Visibility="{Binding ElementName=txtPassword, Path=Password.Length, Converter={StaticResource EmptyPasswordToVisibilityConverter}}" Margin="0, 5" Width="300"/>-->
<TextBox x:Name="txtPassword" Width="300" Height="45" Background="#FE8501" Foreground="Black" FontSize="16" FontWeight="SemiBold" local:Placeholder.Placeholder="Password" VerticalContentAlignment="Center"/>
</StackPanel>

</Border>

<!-- Login Button -->
Expand Down
15 changes: 15 additions & 0 deletions Appview/Views/Login.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System.Windows.Shapes;
using static Appview.ViewModel.UserSession;
using Appview.Services;
using System.Globalization;


namespace Appview.Views
Expand Down Expand Up @@ -50,6 +51,7 @@ private async void LoginButton_Click(object sender, RoutedEventArgs e)
var db = new Database();
string username = txtUsername.Text; // Replace with the actual name of the Username TextBox
string password = txtPassword.Text; // Replace with the actual name of the Password TextBox
//string password = txtPassword.Password; // Replace with the actual name of the Password TextBox
bool isHotel = radioHotel.IsChecked == true;

if (!radioCustomer.IsChecked == true && !isHotel)
Expand Down Expand Up @@ -103,5 +105,18 @@ private async void LoginButton_Click(object sender, RoutedEventArgs e)
}
}
}
public class EmptyPasswordToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value?.ToString()) ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}

}
}
2 changes: 1 addition & 1 deletion Appview/Views/RecommendedFood.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<!-- Search Bar -->
<Border BorderBrush="White" BorderThickness="2" CornerRadius="5" Padding="2" Margin="10">
<TextBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Height="35" FontSize="18" Background="#FB6501" Foreground="White" local:Placeholder.Placeholder="Search Products..." VerticalContentAlignment="Center" Text="{Binding SearchQuery, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Height="35" FontSize="18" Background="#EB8831" Foreground="White" local:Placeholder.Placeholder="Cari Produk di Sini" VerticalContentAlignment="Center" Text="{Binding SearchQuery, UpdateSourceTrigger=PropertyChanged}"/>
</Border>


Expand Down
10 changes: 4 additions & 6 deletions Appview/Views/Register.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@
<TextBox Margin="0, 5" Width="200" Foreground="White"
Background="DarkOrange" BorderThickness="1"
BorderBrush="White" Padding="5"
local:Placeholder.Placeholder="Username..." x:Name="txtUsername" />
local:Placeholder.Placeholder="Username" x:Name="txtUsername" />

<TextBox Margin="0, 5" Width="200" Foreground="White"
Background="DarkOrange" BorderThickness="1"
BorderBrush="White" Padding="5"
local:Placeholder.Placeholder="Email..." x:Name="txtEmail" />
local:Placeholder.Placeholder="Email" x:Name="txtEmail" />

<TextBox Margin="0, 5" Width="200" Foreground="White"
Background="DarkOrange" BorderThickness="1"
BorderBrush="White" Padding="5"
local:Placeholder.Placeholder="Password..." x:Name="txtPassword" />
local:Placeholder.Placeholder="Password" x:Name="txtPassword" />

<TextBox Margin="0, 5" Width="200" Foreground="White"
Background="DarkOrange" BorderThickness="1"
BorderBrush="White" Padding="5"
local:Placeholder.Placeholder="Confirm Password..." x:Name="txtPasswordConfirm" />
local:Placeholder.Placeholder="Confirm Password" x:Name="txtPasswordConfirm" />
</StackPanel>

<Button Content="Register" HorizontalAlignment="Right" Width="69" Foreground="White"
Expand All @@ -74,6 +74,4 @@
</Grid>
</Viewbox>
</Grid>


</UserControl>
2 changes: 2 additions & 0 deletions Appview/Views/Register.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ private void RegisterButton_Click(object sender, RoutedEventArgs e)
string username = txtUsername.Text;
string email = txtEmail.Text;
string password = txtPassword.Text;
//string password = txtPassword.Password;
string confirmPassword = txtPasswordConfirm.Text;
//string confirmPassword = txtPasswordConfirm.Password;
bool isHotel = radioHotel.IsChecked == true;

// Basic validation
Expand Down

0 comments on commit f473d1d

Please sign in to comment.