[partition] Check minimum password length for zfs encryption
This commit is contained in:
parent
f156fc3562
commit
d45819d552
@ -464,6 +464,18 @@ ChoicePage::continueApplyDeviceChoice()
|
|||||||
void
|
void
|
||||||
ChoicePage::onActionChanged()
|
ChoicePage::onActionChanged()
|
||||||
{
|
{
|
||||||
|
if ( m_enableEncryptionWidget )
|
||||||
|
{
|
||||||
|
if ( m_config->installChoice() == InstallChoice::Erase && m_eraseFsTypesChoiceComboBox )
|
||||||
|
{
|
||||||
|
m_encryptWidget->setFilesystem( m_eraseFsTypesChoiceComboBox->currentText() );
|
||||||
|
}
|
||||||
|
else if ( m_config->installChoice() == InstallChoice::Replace && m_replaceFsTypesChoiceComboBox )
|
||||||
|
{
|
||||||
|
m_encryptWidget->setFilesystem( m_replaceFsTypesChoiceComboBox->currentText() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Device* currd = selectedDevice();
|
Device* currd = selectedDevice();
|
||||||
if ( currd )
|
if ( currd )
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
#include <kpmcore/fs/filesystem.h>
|
||||||
|
|
||||||
|
constexpr uint ZFS_MIN_LENGTH = 8;
|
||||||
|
|
||||||
/** @brief Does this system support whole-disk encryption?
|
/** @brief Does this system support whole-disk encryption?
|
||||||
*
|
*
|
||||||
@ -150,11 +153,17 @@ EncryptWidget::updateState()
|
|||||||
QString p1 = m_ui->m_passphraseLineEdit->text();
|
QString p1 = m_ui->m_passphraseLineEdit->text();
|
||||||
QString p2 = m_ui->m_confirmLineEdit->text();
|
QString p2 = m_ui->m_confirmLineEdit->text();
|
||||||
|
|
||||||
|
|
||||||
if ( p1.isEmpty() && p2.isEmpty() )
|
if ( p1.isEmpty() && p2.isEmpty() )
|
||||||
{
|
{
|
||||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
||||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||||
}
|
}
|
||||||
|
else if ( FileSystem::typeForName( m_filesystem ) == FileSystem::Zfs && p1.length() < ZFS_MIN_LENGTH )
|
||||||
|
{
|
||||||
|
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
|
||||||
|
m_ui->m_iconLabel->setToolTip( tr( "Password must be a minimum of %1 characters" ).arg( ZFS_MIN_LENGTH ) );
|
||||||
|
}
|
||||||
else if ( p1 == p2 )
|
else if ( p1 == p2 )
|
||||||
{
|
{
|
||||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
||||||
@ -201,3 +210,10 @@ EncryptWidget::onCheckBoxStateChanged( int checked )
|
|||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EncryptWidget::setFilesystem( const QString& fs )
|
||||||
|
{
|
||||||
|
m_filesystem = fs;
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
@ -38,6 +38,12 @@ public:
|
|||||||
Encryption state() const;
|
Encryption state() const;
|
||||||
void setText( const QString& text );
|
void setText( const QString& text );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setFilesystem sets the filesystem name used for password validation
|
||||||
|
* @param fs A QString containing the name of the filesystem
|
||||||
|
*/
|
||||||
|
void setFilesystem( const QString& fs );
|
||||||
|
|
||||||
QString passphrase() const;
|
QString passphrase() const;
|
||||||
|
|
||||||
void retranslate();
|
void retranslate();
|
||||||
@ -52,6 +58,8 @@ private:
|
|||||||
|
|
||||||
Ui::EncryptWidget* m_ui;
|
Ui::EncryptWidget* m_ui;
|
||||||
Encryption m_state;
|
Encryption m_state;
|
||||||
|
|
||||||
|
QString m_filesystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENCRYPTWIDGET_H
|
#endif // ENCRYPTWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user