diff options
author | Sarper Akdemir <sarper.akdemir.extern@allotropia.de> | 2023-11-08 07:36:52 +0300 |
---|---|---|
committer | Sarper Akdemir <sarper.akdemir.extern@allotropia.de> | 2023-11-15 19:48:38 +0100 |
commit | cdcff8c34144e883eca9dc6e1a85968ed34909c2 (patch) | |
tree | 3e976e02a3b3b43aa7962850b07efad63f5f25b1 /uui | |
parent | 51d9c9899f54200a2bf9bf49df16c03cca403498 (diff) |
tdf#157518: add password strength meter to setmasterpassworddlg
Moves PasswordStrength bits that provide utility functions from cui to svl,
merging them with PasswordHelper there.
Adds password strength bar for the set master password dialog.
(accessible via Tools -> Options -> LibreOffice -> Security -> Passwords for Web
Connections)
Change-Id: I8dc1090a041f8388c2e139beb1d0d9a0beb8acb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159370
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'uui')
-rw-r--r-- | uui/source/masterpasscrtdlg.cxx | 7 | ||||
-rw-r--r-- | uui/source/masterpasscrtdlg.hxx | 1 | ||||
-rw-r--r-- | uui/uiconfig/ui/setmasterpassworddlg.ui | 23 |
3 files changed, 24 insertions, 7 deletions
diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx index 4801bec28f85..2216ea5a1d48 100644 --- a/uui/source/masterpasscrtdlg.cxx +++ b/uui/source/masterpasscrtdlg.cxx @@ -21,6 +21,7 @@ #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <strings.hrc> +#include <svl/PasswordHelper.hxx> #include "masterpasscrtdlg.hxx" // MasterPasswordCreateDialog--------------------------------------------------- @@ -28,7 +29,10 @@ IMPL_LINK_NOARG(MasterPasswordCreateDialog, EditHdl_Impl, weld::Entry&, void) { - m_xOKBtn->set_sensitive(m_xEDMasterPasswordCrt->get_text().getLength() >= 1); + OUString aPasswordText = m_xEDMasterPasswordCrt->get_text(); + m_xOKBtn->set_sensitive(aPasswordText.getLength() >= 1); + m_xPasswdStrengthBar->set_percentage( + SvPasswordHelper::GetPasswordStrengthPercentage(aPasswordText)); } IMPL_LINK_NOARG(MasterPasswordCreateDialog, OKHdl_Impl, weld::Button&, void) @@ -55,6 +59,7 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog(weld::Window* pParent, co , m_xEDMasterPasswordCrt(m_xBuilder->weld_entry("password1")) , m_xEDMasterPasswordRepeat(m_xBuilder->weld_entry("password2")) , m_xOKBtn(m_xBuilder->weld_button("ok")) + , m_xPasswdStrengthBar(m_xBuilder->weld_level_bar("password1levelbar")) { m_xOKBtn->set_sensitive(false); m_xOKBtn->connect_clicked( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) ); diff --git a/uui/source/masterpasscrtdlg.hxx b/uui/source/masterpasscrtdlg.hxx index a8695fc1ed27..f7f01cda79cc 100644 --- a/uui/source/masterpasscrtdlg.hxx +++ b/uui/source/masterpasscrtdlg.hxx @@ -29,6 +29,7 @@ private: std::unique_ptr<weld::Entry> m_xEDMasterPasswordCrt; std::unique_ptr<weld::Entry> m_xEDMasterPasswordRepeat; std::unique_ptr<weld::Button> m_xOKBtn; + std::unique_ptr<weld::LevelBar> m_xPasswdStrengthBar; DECL_LINK(OKHdl_Impl, weld::Button&, void); DECL_LINK(EditHdl_Impl, weld::Entry&, void); diff --git a/uui/uiconfig/ui/setmasterpassworddlg.ui b/uui/uiconfig/ui/setmasterpassworddlg.ui index 0402b4de7b35..52cec48eb30a 100644 --- a/uui/uiconfig/ui/setmasterpassworddlg.ui +++ b/uui/uiconfig/ui/setmasterpassworddlg.ui @@ -130,18 +130,29 @@ </packing> </child> <child> + <object class="GtkLevelBar" id="password1levelbar"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="setmasterpassworddlg|label3">_Reenter password:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">password2</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">password2</property> <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -161,7 +172,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -180,7 +191,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> </object> |