mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 01:15:38 -04:00
[users] Allow an explicit check for non-emptiness of passwords
- move the explicit checking for non-empty into a specific (normal) password check - leave only the-two-fields-are-equal outside of the password- requirements framework - having non-empty is the same as minLength 1, but gives a different error message
This commit is contained in:
parent
ffbc1a3e7d
commit
cc66903678
2 changed files with 18 additions and 10 deletions
|
@ -407,14 +407,7 @@ UsersPage::validateHostnameText( const QString& textRef )
|
|||
bool
|
||||
UsersPage::checkPasswordAcceptance( const QString& pw1, const QString& pw2, QLabel* badge, QLabel* message )
|
||||
{
|
||||
if ( pw1.isEmpty() && pw2.isEmpty() )
|
||||
{
|
||||
// Not exactly labelOk() because we also don't want a checkmark OK
|
||||
badge->clear();
|
||||
message->clear();
|
||||
return false;
|
||||
}
|
||||
else if ( pw1 != pw2 )
|
||||
if ( pw1 != pw2 )
|
||||
{
|
||||
labelError( badge, message, tr( "Your passwords do not match!" ) );
|
||||
return false;
|
||||
|
@ -510,6 +503,14 @@ UsersPage::addPasswordCheck( const QString& key, const QVariant& value )
|
|||
{
|
||||
add_check_maxLength( m_passwordChecks, value );
|
||||
}
|
||||
else if ( key == "nonempty" )
|
||||
{
|
||||
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()); } ) );
|
||||
}
|
||||
}
|
||||
#ifdef CHECK_PWQUALITY
|
||||
else if ( key == "libpwquality" )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue