diff --git a/Controllers/MorePageController.cs b/Controllers/MorePageController.cs
index d92b5d1..0592663 100644
--- a/Controllers/MorePageController.cs
+++ b/Controllers/MorePageController.cs
@@ -20,7 +20,7 @@ namespace ShoopNCook.Controllers
public void Logout()
{
- UserNotifier.Notice("You have been loged out.");
+ UserNotifier.Notice("You have been logged out.");
app.ForceLogin();
}
diff --git a/Views/LoginPage.xaml b/Views/LoginPage.xaml
index 2d3e429..28662c1 100644
--- a/Views/LoginPage.xaml
+++ b/Views/LoginPage.xaml
@@ -60,12 +60,14 @@
Grid.Column="2"
Placeholder="Password"
x:Name="PasswordEntry"
- IsPassword="True"/>
+ IsPassword="{Binding PasswordHide}"/>
+
-
+ HeightRequest="30"
+ x:Name="PasswordReveal"
+ Clicked="OnPasswordRevealClicked"/>
+
diff --git a/Views/LoginPage.xaml.cs b/Views/LoginPage.xaml.cs
index 1c3eef4..4233671 100644
--- a/Views/LoginPage.xaml.cs
+++ b/Views/LoginPage.xaml.cs
@@ -6,20 +6,44 @@ namespace ShoopNCook.Pages;
public partial class LoginPage : ContentPage
{
private readonly LoginController controller;
- public LoginPage(LoginController controller)
- {
- InitializeComponent();
+
+ private readonly BindableProperty PasswordHideProperty = BindableProperty.Create(nameof(PasswordHide), typeof(bool), typeof(LoginPage), false);
+ public bool PasswordHide {
+ get => (bool) GetValue(PasswordHideProperty);
+ private set => SetValue(PasswordHideProperty, value);
+ }
+
+ public LoginPage(LoginController controller)
+ {
+ InitializeComponent();
+ BindingContext = this;
+ SetPasswordHide(true);
this.controller = controller;
- }
+ }
private void OnLoginButtonClicked(object sender, EventArgs e)
{
string email = EmailEntry.Text;
string password = PasswordEntry.Text;
controller.Login(email, password);
}
-
+
private async void RegisterLabbelTapped(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//Register");
}
+
+ private void OnPasswordRevealClicked(object sender, EventArgs e)
+ {
+ SetPasswordHide(!PasswordHide);
+ }
+
+ public void SetPasswordHide(bool shown)
+ {
+ PasswordHide = shown;
+
+ if (shown)
+ PasswordReveal.Source = ImageSource.FromFile("visibility_off.svg");
+ else
+ PasswordReveal.Source = ImageSource.FromFile("visibility_on.svg");
+ }
}
\ No newline at end of file
diff --git a/Views/RegisterPage.xaml b/Views/RegisterPage.xaml
index 1cb4125..e4e65c3 100644
--- a/Views/RegisterPage.xaml
+++ b/Views/RegisterPage.xaml
@@ -80,11 +80,13 @@
Grid.Column="2"
Placeholder="Password"
x:Name="PasswordEntry"
- IsPassword="True"/>
+ IsPassword="{Binding PasswordHide}"/>
+
+ HeightRequest="30"
+ x:Name="PasswordReveal"
+ Clicked="OnPasswordRevealClicked"/>
diff --git a/Views/RegisterPage.xaml.cs b/Views/RegisterPage.xaml.cs
index 65c3b2c..d658732 100644
--- a/Views/RegisterPage.xaml.cs
+++ b/Views/RegisterPage.xaml.cs
@@ -4,10 +4,21 @@ namespace ShoopNCook.Pages;
public partial class RegisterPage : ContentPage
{
- private readonly RegisterController controller;
- public RegisterPage(RegisterController controller)
+ private readonly RegisterController controller;
+
+ private readonly BindableProperty PasswordHideProperty = BindableProperty.Create(nameof(PasswordHide), typeof(bool), typeof(LoginPage), false);
+ public bool PasswordHide
+ {
+ get => (bool)GetValue(PasswordHideProperty);
+ private set => SetValue(PasswordHideProperty, value);
+ }
+
+
+ public RegisterPage(RegisterController controller)
{
InitializeComponent();
+ BindingContext = this;
+ SetPasswordHide(true);
this.controller = controller;
}
private async void LoginTapped(object sender, EventArgs e)
@@ -20,5 +31,20 @@ public partial class RegisterPage : ContentPage
string password = PasswordEntry.Text;
string username = UserNameEntry.Text;
controller.Register(username, email, password);
+ }
+
+ private void OnPasswordRevealClicked(object sender, EventArgs e)
+ {
+ SetPasswordHide(!PasswordHide);
+ }
+
+ public void SetPasswordHide(bool shown)
+ {
+ PasswordHide = shown;
+
+ if (shown)
+ PasswordReveal.Source = ImageSource.FromFile("visibility_off.svg");
+ else
+ PasswordReveal.Source = ImageSource.FromFile("visibility_on.svg");
}
}
\ No newline at end of file