summaryrefslogtreecommitdiff
path: root/cui/source/inc/passwdomdlg.hxx
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-10-18 15:55:52 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-11-06 09:03:47 +0100
commitb1e24664de424a626f78b9fe002bf4d47c8907d5 (patch)
tree603dc8bb48b546fe4d9fb445e8ba6bc7836ec466 /cui/source/inc/passwdomdlg.hxx
parent383f666bcad27b2fbea6ac13a42cafd6f035fc5c (diff)
tdf#157518: add password policy and strength meter to save with password dialog
Introduces new configuration options PasswordPolicy and PasswordPolicyErrorMessage. PasswordPolicy takes a regular expression. When set, it only accepts passwords that match that regular expression. PasswordPolicyErrorMessage is the label displayed when the password does not meet the PasswordPolicy. In the ideal case, it should contain an explainer of the PasswordPolicy, so the user is aware of the requirements. Save with password dialog had maximum password length enforcing bits depending on the requirements of the saved file format. These are still applicable in combination with the password policy. Also introduces a visual password meter under the password entries. If the password policy isn't satisfied the password strength meter is capped at 70%. The entropy bits to password quality is taken as a linear range. Where the range of [0, 112] entropy bits is mapped to percentage [0, 100]. Entropy bits ≥ 112 are mapped to 100% since, according to KeePass' info page, ≥ 112 entropy bits correspond to a strong password: <https://keepass.info/help/kb/pw_quality_est.html> Change-Id: I2e70adacf271916661219f702dfc217292a1b59f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158453 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'cui/source/inc/passwdomdlg.hxx')
-rw-r--r--cui/source/inc/passwdomdlg.hxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 24a1c7b79264..1077195f7a85 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -25,6 +25,7 @@ class PasswordToOpenModifyDialog : public SfxDialogController
{
std::unique_ptr<weld::Entry> m_xPasswdToOpenED;
std::unique_ptr<weld::Label> m_xPasswdToOpenInd;
+ std::unique_ptr<weld::LevelBar> m_xPasswdToOpenBar;
std::unique_ptr<weld::Entry> m_xReenterPasswdToOpenED;
std::unique_ptr<weld::Label> m_xReenterPasswdToOpenInd;
std::unique_ptr<weld::Expander> m_xOptionsExpander;
@@ -33,6 +34,7 @@ class PasswordToOpenModifyDialog : public SfxDialogController
std::unique_ptr<weld::Label> m_xPasswdToModifyFT;
std::unique_ptr<weld::Entry> m_xPasswdToModifyED;
std::unique_ptr<weld::Label> m_xPasswdToModifyInd;
+ std::unique_ptr<weld::LevelBar> m_xPasswdToModifyBar;
std::unique_ptr<weld::Label> m_xReenterPasswdToModifyFT;
std::unique_ptr<weld::Entry> m_xReenterPasswdToModifyED;
std::unique_ptr<weld::Label> m_xReenterPasswdToModifyInd;
@@ -42,6 +44,7 @@ class PasswordToOpenModifyDialog : public SfxDialogController
OUString m_aTwoMismatch;
OUString m_aInvalidStateForOkButton;
OUString m_aInvalidStateForOkButton_v2;
+ std::optional<OUString> m_oPasswordPolicy;
int m_nMaxPasswdLen;
bool m_bIsPasswordToModify;