Disallow next if the root password is not reused or provided.

CAL-344 #close
main
Teo Mrnjavac 9 years ago
parent 8a6dcfbe2f
commit 22470ba4af

@ -47,7 +47,7 @@ UsersPage::UsersPage( QWidget* parent )
, m_readyHostname( false ) , m_readyHostname( false )
, m_readyPassword( false ) , m_readyPassword( false )
, m_readyRootPassword( false ) , m_readyRootPassword( false )
, m_showRootPassword( true ) , m_writeRootPassword( true )
{ {
ui->setupUi( this ); ui->setupUi( this );
@ -75,12 +75,13 @@ UsersPage::UsersPage( QWidget* parent )
ui->labelRootPasswordError->setVisible( !checked ); ui->labelRootPasswordError->setVisible( !checked );
ui->textBoxRootPassword->setVisible( !checked ); ui->textBoxRootPassword->setVisible( !checked );
ui->textBoxVerifiedRootPassword->setVisible( !checked ); ui->textBoxVerifiedRootPassword->setVisible( !checked );
checkReady( isReady() );
} ); } );
m_customUsername = false; m_customUsername = false;
m_customHostname = false; m_customHostname = false;
setShowRootPassword( true ); setWriteRootPassword( true );
ui->checkBoxReusePassword->setChecked( true ); ui->checkBoxReusePassword->setChecked( true );
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); ) CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
@ -96,11 +97,14 @@ UsersPage::~UsersPage()
bool bool
UsersPage::isReady() UsersPage::isReady()
{ {
return m_readyFullName && bool readyFields = m_readyFullName &&
m_readyHostname && m_readyHostname &&
m_readyPassword && m_readyPassword &&
( !m_showRootPassword || ( ui->checkBoxReusePassword->isChecked() || m_readyRootPassword ) ) && m_readyUsername;
m_readyUsername; if ( !m_writeRootPassword || ui->checkBoxReusePassword->isChecked() )
return readyFields;
return readyFields && m_readyRootPassword;
} }
@ -124,7 +128,7 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
ui->textBoxUserPassword->text() ); ui->textBoxUserPassword->text() );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );
if ( m_showRootPassword ) if ( m_writeRootPassword )
{ {
if ( ui->checkBoxReusePassword->isChecked() ) if ( ui->checkBoxReusePassword->isChecked() )
j = new SetPasswordJob( "root", j = new SetPasswordJob( "root",
@ -158,10 +162,10 @@ UsersPage::onActivate()
void void
UsersPage::setShowRootPassword( bool show ) UsersPage::setWriteRootPassword( bool write )
{ {
ui->checkBoxReusePassword->setVisible( show ); ui->checkBoxReusePassword->setVisible( write );
m_showRootPassword = show; m_writeRootPassword = write;
} }
@ -424,10 +428,12 @@ void
UsersPage::setAutologinDefault( bool checked ) UsersPage::setAutologinDefault( bool checked )
{ {
ui->checkBoxAutoLogin->setChecked( checked ); ui->checkBoxAutoLogin->setChecked( checked );
emit checkReady( isReady() );
} }
void void
UsersPage::setReusePasswordDefault( bool checked ) UsersPage::setReusePasswordDefault( bool checked )
{ {
ui->checkBoxReusePassword->setChecked( checked ); ui->checkBoxReusePassword->setChecked( checked );
emit checkReady( isReady() );
} }

@ -44,7 +44,7 @@ public:
void onActivate(); void onActivate();
void setShowRootPassword( bool show ); void setWriteRootPassword( bool show );
void setAutologinDefault( bool checked ); void setAutologinDefault( bool checked );
void setReusePasswordDefault( bool checked ); void setReusePasswordDefault( bool checked );
@ -78,7 +78,7 @@ private:
bool m_readyPassword; bool m_readyPassword;
bool m_readyRootPassword; bool m_readyRootPassword;
bool m_showRootPassword; bool m_writeRootPassword;
}; };
#endif // USERSPAGE_H #endif // USERSPAGE_H

@ -151,7 +151,7 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
Calamares::JobQueue::instance()->globalStorage()->insert( "setRootPassword", Calamares::JobQueue::instance()->globalStorage()->insert( "setRootPassword",
configurationMap.value( "setRootPassword" ).toBool() ); configurationMap.value( "setRootPassword" ).toBool() );
m_widget->setShowRootPassword( configurationMap.value( "setRootPassword" ).toBool() ); m_widget->setWriteRootPassword( configurationMap.value( "setRootPassword" ).toBool() );
} }
if ( configurationMap.contains( "doAutologin" ) && if ( configurationMap.contains( "doAutologin" ) &&

Loading…
Cancel
Save