Merge branch 'fix-usersq' into calamares
This commit is contained in:
commit
44ac33845d
@ -59,11 +59,11 @@ updateGSAutoLogin( bool doAutoLogin, const QString& login )
|
||||
|
||||
if ( doAutoLogin && !login.isEmpty() )
|
||||
{
|
||||
gs->insert( "autologinUser", login );
|
||||
gs->insert( "autoLoginUser", login );
|
||||
}
|
||||
else
|
||||
{
|
||||
gs->remove( "autologinUser" );
|
||||
gs->remove( "autoLoginUser" );
|
||||
}
|
||||
|
||||
if ( login.isEmpty() )
|
||||
@ -142,13 +142,13 @@ insertInGlobalStorage( const QString& key, const QString& group )
|
||||
}
|
||||
|
||||
void
|
||||
Config::setAutologinGroup( const QString& group )
|
||||
Config::setAutoLoginGroup( const QString& group )
|
||||
{
|
||||
if ( group != m_autologinGroup )
|
||||
if ( group != m_autoLoginGroup )
|
||||
{
|
||||
m_autologinGroup = group;
|
||||
insertInGlobalStorage( QStringLiteral( "autologinGroup" ), group );
|
||||
emit autologinGroupChanged( group );
|
||||
m_autoLoginGroup = group;
|
||||
insertInGlobalStorage( QStringLiteral( "autoLoginGroup" ), group );
|
||||
emit autoLoginGroupChanged( group );
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,9 +162,9 @@ Config::groupsForThisUser() const
|
||||
{
|
||||
l << g.name();
|
||||
}
|
||||
if ( doAutoLogin() && !autologinGroup().isEmpty() )
|
||||
if ( doAutoLogin() && !autoLoginGroup().isEmpty() )
|
||||
{
|
||||
l << autologinGroup();
|
||||
l << autoLoginGroup();
|
||||
}
|
||||
|
||||
return l;
|
||||
@ -814,13 +814,13 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
// Now it might be explicitly set to empty, which is ok
|
||||
setUserShell( shell );
|
||||
|
||||
setAutologinGroup( CalamaresUtils::getString( configurationMap, "autologinGroup" ) );
|
||||
setAutoLoginGroup( CalamaresUtils::getString( configurationMap, "autoLoginGroup" ) );
|
||||
setSudoersGroup( CalamaresUtils::getString( configurationMap, "sudoersGroup" ) );
|
||||
|
||||
m_hostNameActions = getHostNameActions( configurationMap );
|
||||
|
||||
setConfigurationDefaultGroups( configurationMap, m_defaultGroups );
|
||||
m_doAutoLogin = CalamaresUtils::getBool( configurationMap, "doAutologin", false );
|
||||
m_doAutoLogin = CalamaresUtils::getBool( configurationMap, "doAutoLogin", false );
|
||||
|
||||
m_writeRootPassword = CalamaresUtils::getBool( configurationMap, "setRootPassword", true );
|
||||
Calamares::JobQueue::instance()->globalStorage()->insert( "setRootPassword", m_writeRootPassword );
|
||||
|
@ -92,7 +92,7 @@ class PLUGINDLLEXPORT Config : public Calamares::ModuleSystem::Config
|
||||
|
||||
Q_PROPERTY( QString userShell READ userShell WRITE setUserShell NOTIFY userShellChanged )
|
||||
|
||||
Q_PROPERTY( QString autologinGroup READ autologinGroup WRITE setAutologinGroup NOTIFY autologinGroupChanged )
|
||||
Q_PROPERTY( QString autoLoginGroup READ autoLoginGroup WRITE setAutoLoginGroup NOTIFY autoLoginGroupChanged )
|
||||
Q_PROPERTY( QString sudoersGroup READ sudoersGroup WRITE setSudoersGroup NOTIFY sudoersGroupChanged )
|
||||
|
||||
Q_PROPERTY( bool doAutoLogin READ doAutoLogin WRITE setAutoLogin NOTIFY autoLoginChanged )
|
||||
@ -185,7 +185,7 @@ public:
|
||||
QString userShell() const { return m_userShell; }
|
||||
|
||||
/// The group of which auto-login users must be a member
|
||||
QString autologinGroup() const { return m_autologinGroup; }
|
||||
QString autoLoginGroup() const { return m_autoLoginGroup; }
|
||||
/// The group of which users who can "sudo" must be a member
|
||||
QString sudoersGroup() const { return m_sudoersGroup; }
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
const QList< GroupDescription >& defaultGroups() const { return m_defaultGroups; }
|
||||
/** @brief the names of all the groups for the current user
|
||||
*
|
||||
* Takes into account defaultGroups and autologin behavior.
|
||||
* Takes into account defaultGroups and autoLogin behavior.
|
||||
*/
|
||||
QStringList groupsForThisUser() const;
|
||||
|
||||
@ -253,8 +253,8 @@ public Q_SLOTS:
|
||||
*/
|
||||
void setUserShell( const QString& path );
|
||||
|
||||
/// Sets the autologin group; empty is ignored
|
||||
void setAutologinGroup( const QString& group );
|
||||
/// Sets the autoLogin group; empty is ignored
|
||||
void setAutoLoginGroup( const QString& group );
|
||||
/// Sets the sudoer group; empty is ignored
|
||||
void setSudoersGroup( const QString& group );
|
||||
|
||||
@ -266,7 +266,7 @@ public Q_SLOTS:
|
||||
/// Sets the host name (flags it as "custom")
|
||||
void setHostName( const QString& host );
|
||||
|
||||
/// Sets the autologin flag
|
||||
/// Sets the autoLogin flag
|
||||
void setAutoLogin( bool b );
|
||||
|
||||
/// Set to true to use the user password, unchanged, for root too
|
||||
@ -281,7 +281,7 @@ public Q_SLOTS:
|
||||
|
||||
signals:
|
||||
void userShellChanged( const QString& );
|
||||
void autologinGroupChanged( const QString& );
|
||||
void autoLoginGroupChanged( const QString& );
|
||||
void sudoersGroupChanged( const QString& );
|
||||
void fullNameChanged( const QString& );
|
||||
void loginNameChanged( const QString& );
|
||||
@ -305,7 +305,7 @@ private:
|
||||
|
||||
QList< GroupDescription > m_defaultGroups;
|
||||
QString m_userShell;
|
||||
QString m_autologinGroup;
|
||||
QString m_autoLoginGroup;
|
||||
QString m_sudoersGroup;
|
||||
QString m_fullName;
|
||||
QString m_loginName;
|
||||
|
@ -184,11 +184,11 @@ SetupGroupsJob::exec()
|
||||
tr( "These groups are missing in the target system: %1" ).arg( missingGroups.join( ',' ) ) );
|
||||
}
|
||||
|
||||
if ( m_config->doAutoLogin() && !m_config->autologinGroup().isEmpty() )
|
||||
if ( m_config->doAutoLogin() && !m_config->autoLoginGroup().isEmpty() )
|
||||
{
|
||||
const QString autologinGroup = m_config->autologinGroup();
|
||||
const QString autoLoginGroup = m_config->autoLoginGroup();
|
||||
(void)ensureGroupsExistInTarget(
|
||||
QList< GroupDescription >() << GroupDescription( autologinGroup ), availableGroups, missingGroups );
|
||||
QList< GroupDescription >() << GroupDescription( autoLoginGroup ), availableGroups, missingGroups );
|
||||
}
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
|
@ -83,13 +83,13 @@ UserTests::testGetSet()
|
||||
}
|
||||
{
|
||||
const QString al( "autolg" );
|
||||
QCOMPARE( c.autologinGroup(), QString() );
|
||||
c.setAutologinGroup( al );
|
||||
QCOMPARE( c.autologinGroup(), al );
|
||||
QCOMPARE( c.autoLoginGroup(), QString() );
|
||||
c.setAutoLoginGroup( al );
|
||||
QCOMPARE( c.autoLoginGroup(), al );
|
||||
QVERIFY( !c.doAutoLogin() );
|
||||
c.setAutoLogin( true );
|
||||
QVERIFY( c.doAutoLogin() );
|
||||
QCOMPARE( c.autologinGroup(), al );
|
||||
QCOMPARE( c.autoLoginGroup(), al );
|
||||
}
|
||||
{
|
||||
const QString su( "sudogrp" );
|
||||
|
@ -88,10 +88,10 @@ UsersViewStep::isAtEnd() const
|
||||
}
|
||||
|
||||
|
||||
QList< Calamares::job_ptr >
|
||||
Calamares::JobList
|
||||
UsersViewStep::jobs() const
|
||||
{
|
||||
return m_jobs;
|
||||
return m_config->createJobs();
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,6 @@ UsersViewStep::onActivate()
|
||||
void
|
||||
UsersViewStep::onLeave()
|
||||
{
|
||||
m_jobs = m_config->createJobs();
|
||||
m_config->finalizeGlobalStorage();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
bool isAtBeginning() const override;
|
||||
bool isAtEnd() const override;
|
||||
|
||||
QList< Calamares::job_ptr > jobs() const override;
|
||||
Calamares::JobList jobs() const override;
|
||||
|
||||
void onActivate() override;
|
||||
void onLeave() override;
|
||||
@ -48,8 +48,6 @@ public:
|
||||
|
||||
private:
|
||||
UsersPage* m_widget;
|
||||
Calamares::JobList m_jobs;
|
||||
|
||||
Config* m_config;
|
||||
};
|
||||
|
||||
|
@ -12,16 +12,12 @@
|
||||
|
||||
#include "UsersQmlViewStep.h"
|
||||
|
||||
#include "SetHostNameJob.h"
|
||||
#include "SetPasswordJob.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/NamedEnum.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersQmlViewStepFactory, registerPlugin< UsersQmlViewStep >(); )
|
||||
|
||||
UsersQmlViewStep::UsersQmlViewStep( QObject* parent )
|
||||
@ -43,59 +39,41 @@ bool
|
||||
UsersQmlViewStep::isNextEnabled() const
|
||||
{
|
||||
return m_config->isReady();
|
||||
//return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
UsersQmlViewStep::isBackEnabled() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
UsersQmlViewStep::isAtBeginning() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
UsersQmlViewStep::isAtEnd() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QList< Calamares::job_ptr >
|
||||
Calamares::JobList
|
||||
UsersQmlViewStep::jobs() const
|
||||
{
|
||||
return m_jobs;
|
||||
return m_config->createJobs();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
UsersQmlViewStep::onActivate()
|
||||
{
|
||||
//m_config->onActivate();
|
||||
//QmlViewStep::onActivate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
UsersQmlViewStep::onLeave()
|
||||
{
|
||||
m_jobs = m_config->createJobs();
|
||||
m_config->finalizeGlobalStorage();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
UsersQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_config->setConfigurationMap( configurationMap );
|
||||
|
||||
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
||||
setContextProperty( "Users", m_config );
|
||||
}
|
||||
|
@ -12,14 +12,14 @@
|
||||
#ifndef USERSQMLVIEWSTEP_H
|
||||
#define USERSQMLVIEWSTEP_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <utils/PluginFactory.h>
|
||||
#include <viewpages/QmlViewStep.h>
|
||||
|
||||
#include <DllMacro.h>
|
||||
|
||||
// Config from users module
|
||||
#include "Config.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "utils/PluginFactory.h"
|
||||
#include "viewpages/QmlViewStep.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
class PLUGINDLLEXPORT UsersQmlViewStep : public Calamares::QmlViewStep
|
||||
@ -37,9 +37,8 @@ public:
|
||||
bool isAtBeginning() const override;
|
||||
bool isAtEnd() const override;
|
||||
|
||||
QList< Calamares::job_ptr > jobs() const override;
|
||||
Calamares::JobList jobs() const override;
|
||||
|
||||
void onActivate() override;
|
||||
void onLeave() override;
|
||||
|
||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||
@ -48,7 +47,6 @@ public:
|
||||
|
||||
private:
|
||||
Config* m_config;
|
||||
Calamares::JobList m_jobs;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( UsersQmlViewStepFactory )
|
||||
|
@ -57,9 +57,10 @@ Kirigami.ScrollablePage {
|
||||
id: _userNameField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Your Full Name")
|
||||
onTextChanged: config.fullNameChanged(text)
|
||||
background: Rectangle {
|
||||
text: config.fullName
|
||||
onTextChanged: config.setFullName(text);
|
||||
|
||||
background: Rectangle {
|
||||
color: "#FBFBFB" // Kirigami.Theme.backgroundColor
|
||||
radius: 2
|
||||
opacity: 0.9
|
||||
@ -85,8 +86,8 @@ Kirigami.ScrollablePage {
|
||||
id: _userLoginField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Login Name")
|
||||
//text: config.userName
|
||||
onTextEdited: config.loginNameStatusChanged(text)
|
||||
text: config.loginName
|
||||
onTextChanged: config.setLoginName(text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@ -124,7 +125,8 @@ Kirigami.ScrollablePage {
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Computer Name")
|
||||
text: config.hostName
|
||||
onTextEdited: config.hostNameStatusChanged(text)
|
||||
onTextChanged: config.setHostName(text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
color: "#FBFBFB" // Kirigami.Theme.backgroundColor
|
||||
@ -164,10 +166,12 @@ Kirigami.ScrollablePage {
|
||||
id: _passwordField
|
||||
width: parent.width / 2 - 10
|
||||
placeholderText: qsTr("Password")
|
||||
text: config.userPassword
|
||||
onTextChanged: config.setUserPassword(text)
|
||||
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||
onTextChanged: config.userPasswordStatusChanged(text, _verificationPasswordField.text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@ -183,10 +187,12 @@ Kirigami.ScrollablePage {
|
||||
id: _verificationPasswordField
|
||||
width: parent.width / 2 - 10
|
||||
placeholderText: qsTr("Repeat Password")
|
||||
text: config.userPasswordSecondary
|
||||
onTextChanged: config.setUserPasswordSecondary(text)
|
||||
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||
onTextChanged: config.userPasswordSecondaryChanged(_passwordField.text, text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@ -211,17 +217,14 @@ Kirigami.ScrollablePage {
|
||||
|
||||
CheckBox {
|
||||
|
||||
visible: config.allowWeakPasswords
|
||||
//visible: false
|
||||
visible: config.permitWeakPasswords
|
||||
text: qsTr("Validate passwords quality")
|
||||
checked: config.allowWeakPasswordsDefault
|
||||
onToggled: config.allowWeakPasswordsDefault = !config.allowWeakPasswordsDefault
|
||||
checked: config.requireStrongPasswords
|
||||
onCheckedChanged: config.setRequireStrongPasswords(checked)
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
visible: config.allowWeakPasswords
|
||||
//visible: false
|
||||
visible: config.permitWeakPasswords
|
||||
width: parent.width
|
||||
text: qsTr("When this box is checked, password-strength checking is done and you will not be able to use a weak password.")
|
||||
font.weight: Font.Thin
|
||||
@ -230,24 +233,20 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
|
||||
text: qsTr("Log in automatically without asking for the password")
|
||||
checked: config.doAutologin
|
||||
onToggled: config.doAutologin = !config.doAutologin
|
||||
checked: config.doAutoLogin
|
||||
onCheckedChanged: config.setAutoLogin(checked)
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
|
||||
id: root
|
||||
visible: config.doReusePassword
|
||||
visible: config.writeRootPassword
|
||||
text: qsTr("Reuse user password as root password")
|
||||
checked: config.reuseUserPasswordForRoot
|
||||
//checked: false
|
||||
onToggled: config.reuseUserPasswordForRoot = !config.reuseUserPasswordForRoot
|
||||
onCheckedChanged: config.setReuseUserPasswordForRoot(checked)
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
visible: root.checked
|
||||
width: parent.width
|
||||
text: qsTr("Use the same password for the administrator account.")
|
||||
@ -277,10 +276,12 @@ Kirigami.ScrollablePage {
|
||||
id: _rootPasswordField
|
||||
width: parent.width / 2 -10
|
||||
placeholderText: qsTr("Root Password")
|
||||
text: config.rootPassword
|
||||
onTextChanged: config.setRootPassword(text)
|
||||
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||
onTextChanged: config.rootPasswordChanged(text, _verificationRootPasswordField.text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@ -296,10 +297,12 @@ Kirigami.ScrollablePage {
|
||||
id: _verificationRootPasswordField
|
||||
width: parent.width / 2 -10
|
||||
placeholderText: qsTr("Repeat Root Password")
|
||||
text: config.rootPasswordSecondary
|
||||
onTextChanged: config.setRootPasswordSecondary(text)
|
||||
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||
onTextChanged: config.rootPasswordSecondaryChanged(_rootPasswordField.text, text)
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user