KeepassLib version 2.38

Added a new settings page to allow auto-save or not
App now resumes correctly from suspend
Settings service now allows getting default values
Removed french special characters from metadata
Code cleanup
This commit is contained in:
BONNEVILLE Geoffroy
2018-03-09 18:06:06 +01:00
parent 49637fcc3b
commit e7d731bb04
34 changed files with 203 additions and 42 deletions

View File

@@ -32,9 +32,11 @@ namespace ModernKeePass
AppCenter.Start("79d23520-a486-4f63-af81-8d90bf4e1bea", typeof(Analytics), typeof(Push));
InitializeComponent();
Suspending += OnSuspending;
Resuming += OnResuming;
UnhandledException += OnUnhandledException;
}
#region Event Handlers
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
@@ -98,7 +100,10 @@ namespace ModernKeePass
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
//TODO: Load state from previously terminated application
#if DEBUG
MessageDialogHelper.ShowNotificationDialog("App terminated", "Windows or an error made the app terminate");
#endif
}
// Place the frame in the current Window
@@ -133,6 +138,31 @@ namespace ModernKeePass
Window.Current.Activate();
}
private async void OnResuming(object sender, object e)
{
var currentFrame = Window.Current.Content as Frame;
var database = DatabaseService.Instance;
if (database.DatabaseFile == null)
{
#if DEBUG
ToastNotificationHelper.ShowGenericToast("App suspended", "Nothing to do, no previous database opened");
#endif
return;
}
try
{
if (database.CompositeKey != null) await database.ReOpen();
}
catch (Exception ex)
{
currentFrame?.Navigate(typeof(MainPage));
#if DEBUG
MessageDialogHelper.ShowErrorDialog(ex);
#endif
ToastNotificationHelper.ShowGenericToast("App suspended", "Database was closed (changes were saved)");
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
@@ -155,8 +185,8 @@ namespace ModernKeePass
var deferral = e.SuspendingOperation.GetDeferral();
UnhandledException -= OnUnhandledException;
var database = DatabaseService.Instance;
database.Save();
await database.Close();
if (SettingsService.Instance.GetSetting("SaveSuspend", true)) database.Save();
await database.Close(false);
deferral.Complete();
}

View File

@@ -55,7 +55,7 @@ namespace ModernKeePass.Common
{
if (exception == null) return;
// Create the message dialog and set its content
var messageDialog = CreateBasicDialog("Error occured", exception.Message, "OK");
var messageDialog = CreateBasicDialog(exception.Message, exception.StackTrace, "OK");
// Show the message dialog
await messageDialog.ShowAsync();

View File

@@ -45,5 +45,10 @@ namespace ModernKeePass.Common
};
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
public static void ShowErrorToast(Exception exception)
{
ShowGenericToast(exception.Source, exception.Message);
}
}
}

View File

@@ -15,6 +15,7 @@ namespace ModernKeePass.Interfaces
GroupVm RootGroup { get; set; }
GroupVm RecycleBin { get; set; }
StorageFile DatabaseFile { get; set; }
CompositeKey CompositeKey { get; }
PwUuid DataCipher { get; set; }
PwCompressionAlgorithm CompressionAlgorithm { get; set; }
KdfParameters KeyDerivation { get; set; }
@@ -23,12 +24,13 @@ namespace ModernKeePass.Interfaces
bool IsClosed { get; }
bool HasChanged { get; set; }
Task Open(CompositeKey key, bool createNew);
Task Open(CompositeKey key, bool createNew = false);
Task ReOpen();
void UpdateCompositeKey(CompositeKey key);
void Save();
void Save(StorageFile file);
void CreateRecycleBin();
void AddDeletedItem(PwUuid id);
Task Close();
Task Close(bool releaseFile = true);
}
}

View File

@@ -2,7 +2,7 @@
{
public interface ISettingsService
{
T GetSetting<T>(string property);
T GetSetting<T>(string property, T defaultValue = default(T));
void PutSetting<T>(string property, T value);
}
}

View File

@@ -124,6 +124,7 @@
<Compile Include="Interfaces\IResourceService.cs" />
<Compile Include="Services\SingletonServiceBase.cs" />
<Compile Include="TemplateSelectors\SelectableDataTemplateSelector.cs" />
<Compile Include="ViewModels\Items\SettingsSaveVm.cs" />
<Compile Include="Views\MainPageFrames\DonatePage.xaml.cs">
<DependentUpon>DonatePage.xaml</DependentUpon>
</Compile>
@@ -155,6 +156,9 @@
<Compile Include="Views\SettingsPageFrames\SettingsNewDatabasePage.xaml.cs">
<DependentUpon>SettingsNewDatabasePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPageFrames\SettingsSavePage.xaml.cs">
<DependentUpon>SettingsSavePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPageFrames\SettingsSecurityPage.xaml.cs">
<DependentUpon>SettingsSecurityPage.xaml</DependentUpon>
</Compile>
@@ -245,6 +249,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Views\SettingsPageFrames\SettingsSavePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserControls\CompositeKeyUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -357,7 +365,7 @@
<Private>True</Private>
</Reference>
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.37.8000\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<HintPath>..\packages\ModernKeePassLib.2.38.1\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">

View File

@@ -22,6 +22,7 @@ namespace ModernKeePass.Services
private StorageFile _realDatabaseFile;
private StorageFile _databaseFile;
private GroupVm _recycleBin;
private CompositeKey _compositeKey;
public GroupVm RootGroup { get; set; }
@@ -56,6 +57,8 @@ namespace ModernKeePass.Services
}
}
public CompositeKey CompositeKey => _compositeKey;
public PwUuid DataCipher
{
get { return _pwDatabase.DataCipherUuid; }
@@ -87,7 +90,7 @@ namespace ModernKeePass.Services
{
_settings = settings;
}
/// <summary>
/// Open a KeePass database
@@ -104,6 +107,8 @@ namespace ModernKeePass.Services
{
throw new ArgumentNullException(nameof(key));
}
_compositeKey = key;
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
if (createNew)
{
@@ -142,12 +147,17 @@ namespace ModernKeePass.Services
}
}
public async Task ReOpen()
{
await Open(_compositeKey);
}
/// <summary>
/// Commit the changes to the currently opened database to file
/// </summary>
public void Save()
{
if (!_pwDatabase.IsOpen) return;
if (!IsOpen) return;
try
{
_pwDatabase.Save(new NullStatusLogger());
@@ -186,18 +196,18 @@ namespace ModernKeePass.Services
/// <summary>
/// Close the currently opened database
/// </summary>
public async Task Close()
public async Task Close(bool releaseFile = true)
{
_pwDatabase?.Close();
// Restore the backup DB to the original one
if (_settings.GetSetting<bool>("AntiCorruption"))
{
if (_pwDatabase.Modified)
if (_pwDatabase != null && _pwDatabase.Modified)
Save(_realDatabaseFile);
await DatabaseFile.DeleteAsync();
}
DatabaseFile = null;
if (releaseFile) DatabaseFile = null;
}
public void AddDeletedItem(PwUuid id)

View File

@@ -9,7 +9,7 @@ namespace ModernKeePass.Services
{
private readonly IPropertySet _values = ApplicationData.Current.LocalSettings.Values;
public T GetSetting<T>(string property)
public T GetSetting<T>(string property, T defaultValue = default(T))
{
try
{
@@ -17,7 +17,7 @@ namespace ModernKeePass.Services
}
catch (InvalidCastException)
{
return default(T);
return defaultValue;
}
}

View File

@@ -273,4 +273,7 @@
<data name="CompositeKeyErrorUserAccount" xml:space="preserve">
<value>user account</value>
</data>
<data name="SettingsMenuItemSave" xml:space="preserve">
<value>Saving</value>
</data>
</root>

View File

@@ -333,6 +333,18 @@
<data name="SettingsNewDatabaseSample.OnContent" xml:space="preserve">
<value>Yes</value>
</data>
<data name="SettingsSaveDatabaseSuspend.OffContent" xml:space="preserve">
<value>Don't save</value>
</data>
<data name="SettingsSaveDatabaseSuspend.OnContent" xml:space="preserve">
<value>Save</value>
</data>
<data name="SettingsSaveDatabaseSuspendDesc.Text" xml:space="preserve">
<value>This settings is generally recommended. If you enable it, database will automatically be saved on application suspension and closing. However, if your database is huge, saving may be deemed too long by Windows, which will then forcibly kill the app.</value>
</data>
<data name="SettingsSaveDatabaseSuspendTitle.Text" xml:space="preserve">
<value>Auto-save on suspend?</value>
</data>
<data name="SettingsSecurityDesc1.Text" xml:space="preserve">
<value>Here, you may change your database password, key file, or both. Just click on on</value>
</data>

View File

@@ -274,4 +274,7 @@
<data name="CompositeKeyErrorUserAccount" xml:space="preserve">
<value>compte utilisateur</value>
</data>
<data name="SettingsMenuItemSave" xml:space="preserve">
<value>Sauvegardes</value>
</data>
</root>

View File

@@ -333,6 +333,18 @@
<data name="SettingsNewDatabaseSample.OnContent" xml:space="preserve">
<value>Oui</value>
</data>
<data name="SettingsSaveDatabaseSuspend.OffContent" xml:space="preserve">
<value>Ne pas sauvegarder</value>
</data>
<data name="SettingsSaveDatabaseSuspend.OnContent" xml:space="preserve">
<value>Sauvegarder</value>
</data>
<data name="SettingsSaveDatabaseSuspendDesc.Text" xml:space="preserve">
<value>Ce paramètre est généralement recommandé. Si vous l'activez, la base de données sera sauvegardée automatiquement lors de la suspension et de la fermeture. Cependant, si votre base de données est très volumineuse, il se peut que Windows estime que cela prend trop de temps et tue l'application.</value>
</data>
<data name="SettingsSaveDatabaseSuspendTitle.Text" xml:space="preserve">
<value>Sauvegarder automatiquement lors de la suspension ?</value>
</data>
<data name="SettingsSecurityDesc1.Text" xml:space="preserve">
<value>Ici, vous pouvez changer le mot de passe maître, le fichier de clé, ou les deux. Cliquez simplement sur</value>
</data>

View File

@@ -137,7 +137,7 @@ namespace ModernKeePass.ViewModels
if (HasPassword) errorMessage.Append(_resource.GetResourceValue("CompositeKeyErrorUserPassword"));
if (HasPassword && HasKeyFile) errorMessage.Append(_resource.GetResourceValue("CompositeKeyErrorUserOr"));
if (HasKeyFile) errorMessage.Append(_resource.GetResourceValue("CompositeKeyErrorUserKeyFile"));
if (HasKeyFile) errorMessage.Append(_resource.GetResourceValue("CompositeKeyErrorUserAccount"));
if (HasUserAccount) errorMessage.Append(_resource.GetResourceValue("CompositeKeyErrorUserAccount"));
UpdateStatus(errorMessage.ToString(), StatusTypes.Error);
}
catch (Exception e)

View File

@@ -6,7 +6,7 @@ namespace ModernKeePass.ViewModels
{
public class SettingsNewVm
{
private ISettingsService _settings;
private readonly ISettingsService _settings;
public SettingsNewVm() : this(SettingsService.Instance)
{ }

View File

@@ -0,0 +1,24 @@
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
namespace ModernKeePass.ViewModels
{
public class SettingsSaveVm
{
private readonly ISettingsService _settings;
public SettingsSaveVm() : this(SettingsService.Instance)
{ }
public SettingsSaveVm(ISettingsService settings)
{
_settings = settings;
}
public bool IsSaveSuspend
{
get { return _settings.GetSetting("SaveSuspend", true); }
set { _settings.PutSetting("SaveSuspend", value); }
}
}
}

View File

@@ -55,6 +55,13 @@ namespace ModernKeePass.ViewModels
IsSelected = true
},
new ListMenuItemVm
{
Title = resource.GetResourceValue("SettingsMenuItemSave"),
Group = resource.GetResourceValue("SettingsMenuGroupApplication"),
SymbolIcon = Symbol.Save,
PageType = typeof(SettingsSavePage)
},
new ListMenuItemVm
{
Title = resource.GetResourceValue("SettingsMenuItemGeneral"),
Group = resource.GetResourceValue("SettingsMenuGroupDatabase"),

View File

@@ -0,0 +1,18 @@
<Page
x:Class="ModernKeePass.Views.SettingsSavePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:ModernKeePass.ViewModels"
mc:Ignorable="d">
<Page.DataContext>
<viewModels:SettingsSaveVm />
</Page.DataContext>
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock x:Uid="SettingsSaveDatabaseSuspendTitle" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,0,0,10"/>
<TextBlock x:Uid="SettingsSaveDatabaseSuspendDesc" TextWrapping="WrapWholeWords" Margin="5,0,0,10"/>
<ToggleSwitch x:Uid="SettingsSaveDatabaseSuspend" IsOn="{Binding IsSaveSuspend, Mode=TwoWay}" />
</StackPanel>
</Page>

View File

@@ -0,0 +1,15 @@
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SettingsSavePage
{
public SettingsSavePage()
{
InitializeComponent();
}
}
}

View File

@@ -2,7 +2,6 @@
x:Class="ModernKeePass.Views.SettingsSecurityPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModernKeePass.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:userControls="using:ModernKeePass.Views.UserControls"

View File

@@ -1,2 +1,4 @@
New inline menu on Entries to quickly copy login, password, and navigate to URL
Design changes
Application now correctly resumes from suspend
Code enhancements
Return of the Donate page, with Paypal
KeePassLib version bump to 2.38

View File

@@ -1,6 +1,6 @@
En avez-vous assez d'essayer de retenir des quantit&amp;eacute;s de mots de passe ? Etes-vous soucieux que le fait d'utiliser le m&amp;ecirc;me mot de passe partout vous rend vuln&amp;eacute;rable ?
ModernKeePass est un gestionnaire de mots de passe gratuit, libre, facile &amp;agrave; utiliser mais n&amp;eacute;anmoins s&amp;ucirc;r, bas&amp;eacute; sur la technologie certifi&amp;eacute;e et r&amp;eacute;pandue KeePass 2.x et compatible avec celui-ci.
Vous pouvez stocker ou g&amp;eacute;n&amp;eacute;rer vos mots de passe dans une base de donn&amp;eacute;es chiffr&amp;eacute;e, qui peut &amp;ecirc;tre plac&amp;eacute;e n'importe o&amp;ugrave; (ordinateur personnel/tablette, cloud, cl&amp;eacute; USB...)
En avez-vous assez d'essayer de retenir des quantites de mots de passe ? Etes-vous soucieux que le fait d'utiliser le meme mot de passe partout vous rend vulnerable ?
ModernKeePass est un gestionnaire de mots de passe gratuit, libre, facile a utiliser mais neanmoins sur, base sur la technologie certifiee et repandue KeePass 2.x et compatible avec celui-ci.
Vous pouvez stocker ou generer vos mots de passe dans une base de donnees chiffree, qui peut etre placee n'importe ou (ordinateur personnel/tablette, cloud, cle USB...)
Bien que la s&amp;eacute;curit&amp;eacute; informatique soit tr&amp;egrave;s importante, cette application essaie de rester simple &amp;agrave; utiliser et &amp;agrave; comprendre. Vos suggestions sont les bienvenues !
Bien que la securite informatique soit tres importante, cette application essaie de rester simple a utiliser et a comprendre. Vos suggestions sont les bienvenues !
Fonctionne sur Windows 10, 8.1 et RT.

View File

@@ -1 +1 @@
Page d'entr&amp;eacute;e avec g&amp;eacute;n&amp;eacute;rateur de mot de passe
Page d'entree avec generateur de mot de passe

View File

@@ -1 +1 @@
Filtrez vos entr&amp;eacute;es pour rapidement trouver celle qui vous int&amp;eacute;resse
Filtrez vos entrees pour rapidement trouver celle qui vous interesse

View File

@@ -1 +1 @@
Vue d'un groupe, avec ses sous-groupes et ses entr&amp;eacute;es
Vue d'un groupe, avec ses sous-groupes et ses entrees

View File

@@ -1 +1 @@
Cr&amp;eacute;ez de nouvelles bases de donn&amp;eacute;es, en d&amp;eacute;finissant un mot de passe et/ou un fichier de cl&amp;eacute; existant ou nouveau
Creez de nouvelles bases de donnees, en definissant un mot de passe et/ou un fichier de cle existant ou nouveau

View File

@@ -1 +1 @@
Ouvrez une base de donn&amp;eacute;es avec mot de passe et/ou fichier de cl&amp;eacute;
Ouvrez une base de donnees avec mot de passe et/ou fichier de cle

View File

@@ -1 +1 @@
Ouvrez les fichiers r&amp;eacute;cents
Ouvrez les fichiers recents

View File

@@ -1 +1 @@
Vue d'ensemble avec le zoom s&amp;eacute;mantique
Vue d'ensemble avec le zoom semantique

View File

@@ -1 +1 @@
Param&amp;egrave;tres de l'application
Parametres de l'application

View File

@@ -1,2 +1,4 @@
Ajout d'un menu int&amp;eacute;gr&amp;eacute; &amp;agrave; la liste d'entr&amp;eacute;es afin de copier rapidement le login, mot de passe et de naviguer vers l'URL
Quelques changements de design
L'application recupere correctement d'une suspension
Ameliorations de code
Retour de la page de donation, avec Paypal
Version de la KeePassLib montee a 2.38

View File

@@ -7,7 +7,7 @@
<package id="Microsoft.NETCore.Platforms" version="2.0.1" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.37.8000" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.38.1" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.1" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.1.3" targetFramework="win81" />
<package id="Splat" version="2.0.0" targetFramework="win81" />