1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-01 08:03:37 +00:00

Colorized passwords (#424)

* Added utility to format passwords using spans

* Use the password formatter to render the cipher password

* Colorize the password in the password generator
This commit is contained in:
Andreas Schneider
2018-12-10 15:30:11 +01:00
committed by Kyle Spearrin
parent 8fc5ad099b
commit 421f7e8799
5 changed files with 98 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
using System;
using System.ComponentModel;
using Bit.App.Utilities;
using Xamarin.Forms;
namespace Bit.App.Models.Page
{
@@ -19,9 +21,15 @@ namespace Bit.App.Models.Page
{
_password = value;
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Password)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(FormattedPassword)));
}
}
public FormattedString FormattedPassword
{
get { return PasswordFormatter.FormatPassword(_password); }
}
public string Length
{
get { return _length; }

View File

@@ -4,6 +4,7 @@ using Xamarin.Forms;
using System.Collections.Generic;
using Bit.App.Enums;
using Bit.App.Resources;
using Bit.App.Utilities;
namespace Bit.App.Models.Page
{
@@ -122,7 +123,7 @@ namespace Bit.App.Models.Page
{
_loginPassword = value;
PropertyChanged(this, new PropertyChangedEventArgs(nameof(LoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(MaskedLoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(FormattedLoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(ShowLoginPassword)));
}
}
@@ -134,12 +135,12 @@ namespace Bit.App.Models.Page
{
_loginRevealPassword = value;
PropertyChanged(this, new PropertyChangedEventArgs(nameof(RevealLoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(MaskedLoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(FormattedLoginPassword)));
PropertyChanged(this, new PropertyChangedEventArgs(nameof(LoginShowHideImage)));
}
}
public string MaskedLoginPassword => RevealLoginPassword ?
LoginPassword : LoginPassword == null ? null : MaskedPasswordString;
public FormattedString FormattedLoginPassword => RevealLoginPassword ?
PasswordFormatter.FormatPassword(LoginPassword) : LoginPassword == null ? null : MaskedPasswordString;
public ImageSource LoginShowHideImage => RevealLoginPassword ?
ImageSource.FromFile("eye_slash.png") : ImageSource.FromFile("eye.png");