Allow reusing the user password as root password.

main
Teo Mrnjavac 9 years ago
parent 97bc1f71ea
commit bbd8fe6203

@ -66,11 +66,22 @@ UsersPage::UsersPage( QWidget* parent )
this, &UsersPage::onRootPasswordTextChanged );
connect( ui->textBoxVerifiedRootPassword, &QLineEdit::textChanged,
this, &UsersPage::onRootPasswordTextChanged );
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged,
this, [this]( int checked )
{
ui->labelChooseRootPassword->setVisible( !checked );
ui->labelExtraRootPassword->setVisible( !checked );
ui->labelRootPassword->setVisible( !checked );
ui->labelRootPasswordError->setVisible( !checked );
ui->textBoxRootPassword->setVisible( !checked );
ui->textBoxVerifiedRootPassword->setVisible( !checked );
} );
m_customUsername = false;
m_customHostname = false;
setShowRootPassword( true );
ui->checkBoxReusePassword->setChecked( true );
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
}
@ -88,7 +99,7 @@ UsersPage::isReady()
return m_readyFullName &&
m_readyHostname &&
m_readyPassword &&
( !m_showRootPassword || m_readyRootPassword ) &&
( !m_showRootPassword || ( ui->checkBoxReusePassword->isChecked() || m_readyRootPassword ) ) &&
m_readyUsername;
}
@ -105,7 +116,7 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
ui->textBoxFullName->text().isEmpty() ?
ui->textBoxUsername->text() :
ui->textBoxFullName->text(),
ui->checkBoxLoginAuto->isChecked(),
ui->checkBoxAutoLogin->isChecked(),
defaultUserGroup,
defaultGroupsList );
list.append( Calamares::job_ptr( j ) );
@ -116,8 +127,12 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
if ( m_showRootPassword )
{
j = new SetPasswordJob( "root",
ui->textBoxRootPassword->text() );
if ( ui->checkBoxReusePassword->isChecked() )
j = new SetPasswordJob( "root",
ui->textBoxUserPassword->text() );
else
j = new SetPasswordJob( "root",
ui->textBoxRootPassword->text() );
list.append( Calamares::job_ptr( j ) );
}
@ -126,7 +141,7 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
gs->insert( "hostname", ui->textBoxHostname->text() );
if ( ui->checkBoxLoginAuto->isChecked() )
if ( ui->checkBoxAutoLogin->isChecked() )
gs->insert( "autologinUser", ui->textBoxUsername->text() );
gs->insert( "username", ui->textBoxUsername->text() );
@ -146,13 +161,7 @@ UsersPage::onActivate()
void
UsersPage::setShowRootPassword( bool show )
{
ui->labelChooseRootPassword->setVisible( show );
ui->labelExtraRootPassword->setVisible( show );
ui->labelRootPassword->setVisible( show );
ui->labelRootPasswordError->setVisible( show );
ui->textBoxRootPassword->setVisible( show );
ui->textBoxVerifiedRootPassword->setVisible( show );
ui->checkBoxReusePassword->setVisible( show );
m_showRootPassword = show;
}
@ -415,6 +424,5 @@ UsersPage::onRootPasswordTextChanged( const QString& )
void
UsersPage::setAutologinDefault( bool checked )
{
ui->checkBoxLoginAuto->setChecked( checked );
ui->checkBoxLoginNormal->setChecked( !checked );
ui->checkBoxAutoLogin->setChecked( checked );
}

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>862</width>
<height>597</height>
<height>683</height>
</rect>
</property>
<property name="windowTitle">
@ -19,10 +19,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -97,10 +100,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -199,22 +205,25 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="password_label_2">
<widget class="QLabel" name="hostname_label_2">
<property name="text">
<string>Choose a password to keep your account safe.</string>
<string>What is the name of this computer?</string>
</property>
<property name="wordWrap">
<bool>false</bool>
@ -222,28 +231,9 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="textBoxUserPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="textBoxUserVerifiedPassword">
<widget class="QLineEdit" name="textBoxHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -256,13 +246,10 @@
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUserPassword">
<widget class="QLabel" name="labelHostname">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -287,7 +274,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="labelUserPasswordError">
<widget class="QLabel" name="labelHostnameError">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
@ -296,7 +283,7 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<width>200</width>
<height>0</height>
</size>
</property>
@ -314,35 +301,38 @@
</layout>
</item>
<item>
<widget class="QLabel" name="password_extra_label_3">
<widget class="QLabel" name="hostname_extra_label_2">
<property name="styleSheet">
<string>font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors. A good password will contain a mixture of letters, numbers and punctuation, should be at least eight characters long, and should be changed at regular intervals.&lt;/small&gt;</string>
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="hostname_label_2">
<widget class="QLabel" name="password_label_2">
<property name="text">
<string>What is the name of this computer?</string>
<string>Choose a password to keep your account safe.</string>
</property>
<property name="wordWrap">
<bool>false</bool>
@ -350,9 +340,28 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="textBoxHostname">
<widget class="QLineEdit" name="textBoxUserPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="textBoxUserVerifiedPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -365,10 +374,13 @@
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostname">
<widget class="QLabel" name="labelUserPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -393,7 +405,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="labelHostnameError">
<widget class="QLabel" name="labelUserPasswordError">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
@ -402,7 +414,7 @@
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>100</width>
<height>0</height>
</size>
</property>
@ -420,27 +432,44 @@
</layout>
</item>
<item>
<widget class="QLabel" name="hostname_extra_label_2">
<widget class="QLabel" name="password_extra_label_3">
<property name="styleSheet">
<string>font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors. A good password will contain a mixture of letters, numbers and punctuation, should be at least eight characters long, and should be changed at regular intervals.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<widget class="QCheckBox" name="checkBoxAutoLogin">
<property name="text">
<string>Log in automatically without asking for the password.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxReusePassword">
<property name="text">
<string>Use the same password for the administrator account.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<height>6</height>
</size>
</property>
</spacer>
@ -560,61 +589,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QWidget" name="widget_7" native="true">
<layout class="QGridLayout" name="gridLayout_10">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item row="0" column="1">
<widget class="QRadioButton" name="checkBoxLoginAuto">
<property name="text">
<string>&amp;Log in automatically</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="checkBoxLoginNormal">
<property name="text">
<string>Require &amp;my password to log in</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
@ -630,10 +604,6 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>checkBoxLoginNormal</tabstop>
<tabstop>checkBoxLoginAuto</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

Loading…
Cancel
Save