Merge branch 'patch-6' of https://github.com/bill-auger/calamares into bill-auger-patch-6
This commit is contained in:
commit
799f1131a9
@ -88,6 +88,13 @@ UsersPage::UsersPage( QWidget* parent )
|
|||||||
this, &UsersPage::onRootPasswordTextChanged );
|
this, &UsersPage::onRootPasswordTextChanged );
|
||||||
connect( ui->textBoxVerifiedRootPassword, &QLineEdit::textChanged,
|
connect( ui->textBoxVerifiedRootPassword, &QLineEdit::textChanged,
|
||||||
this, &UsersPage::onRootPasswordTextChanged );
|
this, &UsersPage::onRootPasswordTextChanged );
|
||||||
|
connect( ui->checkBoxValidatePassword, &QCheckBox::stateChanged,
|
||||||
|
this, [this]( int checked )
|
||||||
|
{
|
||||||
|
onPasswordTextChanged( ui->textBoxUserPassword->text() );
|
||||||
|
onRootPasswordTextChanged( ui->textBoxRootPassword->text() );
|
||||||
|
checkReady( isReady() );
|
||||||
|
} );
|
||||||
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged,
|
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged,
|
||||||
this, [this]( int checked )
|
this, [this]( int checked )
|
||||||
{
|
{
|
||||||
@ -105,6 +112,8 @@ UsersPage::UsersPage( QWidget* parent )
|
|||||||
|
|
||||||
setWriteRootPassword( true );
|
setWriteRootPassword( true );
|
||||||
ui->checkBoxReusePassword->setChecked( true );
|
ui->checkBoxReusePassword->setChecked( true );
|
||||||
|
ui->checkBoxValidatePassword->setChecked( true );
|
||||||
|
ui->checkBoxValidatePassword->setVisible( false );
|
||||||
|
|
||||||
// Don't expand the explanations to "stupid wide", but keep them vaguely as-wide-as
|
// Don't expand the explanations to "stupid wide", but keep them vaguely as-wide-as
|
||||||
// the things they are explaining.
|
// the things they are explaining.
|
||||||
@ -387,6 +396,7 @@ UsersPage::onPasswordTextChanged( const QString& )
|
|||||||
{
|
{
|
||||||
QString pw1 = ui->textBoxUserPassword->text();
|
QString pw1 = ui->textBoxUserPassword->text();
|
||||||
QString pw2 = ui->textBoxUserVerifiedPassword->text();
|
QString pw2 = ui->textBoxUserVerifiedPassword->text();
|
||||||
|
m_readyPassword = true;
|
||||||
|
|
||||||
// TODO: 3.3: remove empty-check and leave it to passwordRequirements
|
// TODO: 3.3: remove empty-check and leave it to passwordRequirements
|
||||||
if ( pw1.isEmpty() && pw2.isEmpty() )
|
if ( pw1.isEmpty() && pw2.isEmpty() )
|
||||||
@ -403,23 +413,24 @@ UsersPage::onPasswordTextChanged( const QString& )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool ok = true;
|
if ( ui->checkBoxValidatePassword->isChecked() )
|
||||||
|
{
|
||||||
for ( auto pc : m_passwordChecks )
|
for ( auto pc : m_passwordChecks )
|
||||||
{
|
{
|
||||||
QString s = pc.filter( pw1 );
|
QString s = pc.filter( pw1 );
|
||||||
|
|
||||||
if ( !s.isEmpty() )
|
if ( !s.isEmpty() )
|
||||||
{
|
{
|
||||||
labelError( ui->labelUserPassword, ui->labelUserPasswordError, s );
|
labelError( ui->labelUserPassword, ui->labelUserPasswordError, s );
|
||||||
ok = false;
|
|
||||||
m_readyPassword = false;
|
m_readyPassword = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ok )
|
if ( m_readyPassword )
|
||||||
{
|
{
|
||||||
labelOk( ui->labelUserPassword, ui->labelUserPasswordError );
|
labelOk( ui->labelUserPassword, ui->labelUserPasswordError );
|
||||||
m_readyPassword = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +442,7 @@ UsersPage::onRootPasswordTextChanged( const QString& )
|
|||||||
{
|
{
|
||||||
QString pw1 = ui->textBoxRootPassword->text();
|
QString pw1 = ui->textBoxRootPassword->text();
|
||||||
QString pw2 = ui->textBoxVerifiedRootPassword->text();
|
QString pw2 = ui->textBoxVerifiedRootPassword->text();
|
||||||
|
m_readyRootPassword = true;
|
||||||
|
|
||||||
// TODO: 3.3: remove empty-check and leave it to passwordRequirements
|
// TODO: 3.3: remove empty-check and leave it to passwordRequirements
|
||||||
if ( pw1.isEmpty() && pw2.isEmpty() )
|
if ( pw1.isEmpty() && pw2.isEmpty() )
|
||||||
@ -447,23 +459,24 @@ UsersPage::onRootPasswordTextChanged( const QString& )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool ok = true;
|
if ( ui->checkBoxValidatePassword->isChecked() )
|
||||||
|
{
|
||||||
for ( auto pc : m_passwordChecks )
|
for ( auto pc : m_passwordChecks )
|
||||||
{
|
{
|
||||||
QString s = pc.filter( pw1 );
|
QString s = pc.filter( pw1 );
|
||||||
|
|
||||||
if ( !s.isEmpty() )
|
if ( !s.isEmpty() )
|
||||||
{
|
{
|
||||||
labelError( ui->labelRootPassword, ui->labelRootPasswordError, s );
|
labelError( ui->labelRootPassword, ui->labelRootPasswordError, s );
|
||||||
ok = false;
|
|
||||||
m_readyRootPassword = false;
|
m_readyRootPassword = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ok )
|
if ( m_readyRootPassword )
|
||||||
{
|
{
|
||||||
labelOk( ui->labelRootPassword, ui->labelRootPasswordError );
|
labelOk( ui->labelRootPassword, ui->labelRootPasswordError );
|
||||||
m_readyRootPassword = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,6 +484,19 @@ UsersPage::onRootPasswordTextChanged( const QString& )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
UsersPage::setPasswordCheckboxVisible( bool visible )
|
||||||
|
{
|
||||||
|
ui->checkBoxValidatePassword->setVisible( visible );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UsersPage::setValidatePasswordDefault( bool checked )
|
||||||
|
{
|
||||||
|
ui->checkBoxValidatePassword->setChecked( checked );
|
||||||
|
emit checkReady( isReady() );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UsersPage::setAutologinDefault( bool checked )
|
UsersPage::setAutologinDefault( bool checked )
|
||||||
{
|
{
|
||||||
@ -501,7 +527,7 @@ UsersPage::addPasswordCheck( const QString& key, const QVariant& value )
|
|||||||
{
|
{
|
||||||
add_check_libpwquality( m_passwordChecks, value );
|
add_check_libpwquality( m_passwordChecks, value );
|
||||||
}
|
}
|
||||||
#endif
|
#endif // CHECK_PWQUALITY
|
||||||
else
|
else
|
||||||
cWarning() << "Unknown password-check key" << key;
|
cWarning() << "Unknown password-check key" << key;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
void onActivate();
|
void onActivate();
|
||||||
|
|
||||||
void setWriteRootPassword( bool show );
|
void setWriteRootPassword( bool show );
|
||||||
|
void setPasswordCheckboxVisible( bool visible );
|
||||||
|
void setValidatePasswordDefault( bool checked );
|
||||||
void setAutologinDefault( bool checked );
|
void setAutologinDefault( bool checked );
|
||||||
void setReusePasswordDefault( bool checked );
|
void setReusePasswordDefault( bool checked );
|
||||||
|
|
||||||
|
@ -173,6 +173,18 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "allowWeakPasswords" ) &&
|
||||||
|
configurationMap.value( "allowWeakPasswords" ).type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
m_widget->setPasswordCheckboxVisible( configurationMap.value( "allowWeakPasswords" ).toBool() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "doPasswordChecks" ) &&
|
||||||
|
configurationMap.value( "doPasswordChecks" ).type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
m_widget->setValidatePasswordDefault( configurationMap.value( "doPasswordChecks" ).toBool() );
|
||||||
|
}
|
||||||
|
|
||||||
QString shell( QLatin1String( "/bin/bash" ) ); // as if it's not set at all
|
QString shell( QLatin1String( "/bin/bash" ) ); // as if it's not set at all
|
||||||
if ( configurationMap.contains( "userShell" ) )
|
if ( configurationMap.contains( "userShell" ) )
|
||||||
shell = CalamaresUtils::getString( configurationMap, "userShell" );
|
shell = CalamaresUtils::getString( configurationMap, "userShell" );
|
||||||
|
@ -460,6 +460,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxValidatePassword">
|
||||||
|
<property name="text">
|
||||||
|
<string>Require strong passwords.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxAutoLogin">
|
<widget class="QCheckBox" name="checkBoxAutoLogin">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -28,7 +28,7 @@ defaultGroups:
|
|||||||
# Disable when your Distribution does not require such a group.
|
# Disable when your Distribution does not require such a group.
|
||||||
autologinGroup: autologin
|
autologinGroup: autologin
|
||||||
# You can control the initial state for the 'autologin checkbox' in UsersViewStep here.
|
# You can control the initial state for the 'autologin checkbox' in UsersViewStep here.
|
||||||
# Possible values are: true to enable or false to disable the checkbox by default
|
# Possible values are: true to enable or false to disable the checkbox by default.
|
||||||
doAutologin: true
|
doAutologin: true
|
||||||
|
|
||||||
# When set to a non-empty string, Calamares creates a sudoers file for the user.
|
# When set to a non-empty string, Calamares creates a sudoers file for the user.
|
||||||
@ -68,12 +68,23 @@ doReusePassword: true
|
|||||||
#
|
#
|
||||||
# (additional checks may be implemented in CheckPWQuality.cpp and
|
# (additional checks may be implemented in CheckPWQuality.cpp and
|
||||||
# wired into UsersPage.cpp)
|
# wired into UsersPage.cpp)
|
||||||
|
#
|
||||||
|
# To disable specific password validations,
|
||||||
|
# comment out the relevant 'passwordRequirements' keys below.
|
||||||
|
# To disable all password validations,
|
||||||
|
# set both 'allowWeakPasswords' and 'doPasswordChecks' to false.
|
||||||
passwordRequirements:
|
passwordRequirements:
|
||||||
minLength: -1 # Password at least this many characters
|
minLength: -1 # Password at least this many characters
|
||||||
maxLength: -1 # Password at most this many characters
|
maxLength: -1 # Password at most this many characters
|
||||||
libpwquality:
|
libpwquality:
|
||||||
- minlen=0
|
- minlen=0
|
||||||
- minclass=0
|
- minclass=0
|
||||||
|
# You can control the visibility of the 'strong passwords' checkbox in UsersViewStep here.
|
||||||
|
# Possible values are: true to show or false to hide the checkbox.
|
||||||
|
allowWeakPasswords: true
|
||||||
|
# You can control the initial state for the 'strong passwords' checkbox in UsersViewStep here.
|
||||||
|
# Possible values are: true to enable or false to disable the checkbox by default.
|
||||||
|
doPasswordChecks: true
|
||||||
|
|
||||||
# Shell to be used for the regular user of the target system.
|
# Shell to be used for the regular user of the target system.
|
||||||
# There are three possible kinds of settings:
|
# There are three possible kinds of settings:
|
||||||
|
Loading…
Reference in New Issue
Block a user