[users] Give password-checks a weight, to sort them later

This commit is contained in:
Adriaan de Groot 2019-11-08 13:16:19 +01:00
parent b3e7c3f294
commit dec0cfb7d3
3 changed files with 34 additions and 23 deletions

View file

@ -147,8 +147,8 @@ UsersPage::retranslate()
// Re-do password checks (with output messages) as well.
// .. the password-checking methods get their values from the text boxes,
// not from their parameters.
onPasswordTextChanged(QString());
onRootPasswordTextChanged(QString());
onPasswordTextChanged( QString() );
onRootPasswordTextChanged( QString() );
}
@ -227,8 +227,8 @@ void
UsersPage::onActivate()
{
ui->textBoxFullName->setFocus();
onPasswordTextChanged(QString());
onRootPasswordTextChanged(QString());
onPasswordTextChanged( QString() );
onRootPasswordTextChanged( QString() );
}
@ -514,8 +514,10 @@ UsersPage::addPasswordCheck( const QString& key, const QVariant& value )
{
if ( value.toBool() )
{
m_passwordChecks.push_back( PasswordCheck( []() { return QCoreApplication::translate( "EMP", "Password is empty" ); },
[]( const QString& s ) { return ((cDebug() << "Checking pwd" << s << "for empty"), !s.isEmpty()); } ) );
m_passwordChecks.push_back( PasswordCheck(
[]() { return QCoreApplication::translate( "EMP", "Password is empty" ); },
[]( const QString& s ) { return ( ( cDebug() << "Checking pwd" << s << "for empty" ), !s.isEmpty() ); },
PasswordCheck::Weight( 1 ) ) );
}
}
#ifdef CHECK_PWQUALITY