2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2014-07-31 14:52:05 +02:00
|
|
|
*
|
2015-02-17 20:20:20 +01:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
2018-06-15 11:59:11 +02:00
|
|
|
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
2014-07-31 14:52:05 +02:00
|
|
|
*
|
|
|
|
* Portions from the Manjaro Installation Framework
|
|
|
|
* by Roland Singer <roland@manjaro.org>
|
|
|
|
* Copyright (C) 2007 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef USERSPAGE_H
|
|
|
|
#define USERSPAGE_H
|
|
|
|
|
2014-07-31 19:06:31 +02:00
|
|
|
#include "Typedefs.h"
|
|
|
|
|
2018-01-23 13:02:49 +01:00
|
|
|
#include "CheckPWQuality.h"
|
2014-07-31 14:52:05 +02:00
|
|
|
|
2018-01-23 13:02:49 +01:00
|
|
|
#include <QWidget>
|
2017-09-18 16:08:21 +02:00
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
2014-07-31 14:52:05 +02:00
|
|
|
class Page_UserSetup;
|
|
|
|
}
|
|
|
|
|
|
|
|
class UsersPage : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit UsersPage( QWidget* parent = nullptr );
|
|
|
|
virtual ~UsersPage();
|
|
|
|
|
|
|
|
bool isReady();
|
|
|
|
|
2015-11-17 21:55:50 +01:00
|
|
|
QList< Calamares::job_ptr > createJobs( const QStringList& defaultGroupsList );
|
2014-11-26 18:40:30 +01:00
|
|
|
|
|
|
|
void onActivate();
|
2014-07-31 19:06:31 +02:00
|
|
|
|
2015-11-20 16:27:32 +01:00
|
|
|
void setWriteRootPassword( bool show );
|
2015-08-19 12:51:06 +02:00
|
|
|
void setAutologinDefault( bool checked );
|
2015-11-13 19:25:27 +01:00
|
|
|
void setReusePasswordDefault( bool checked );
|
2015-06-11 04:02:06 +02:00
|
|
|
|
2018-05-23 09:30:51 +02:00
|
|
|
/** @brief Process entries in the passwordRequirements config entry
|
|
|
|
*
|
|
|
|
* Called once for each item in the config entry, which should
|
|
|
|
* be a key-value pair. What makes sense as a value depends on
|
|
|
|
* the key. Supported keys are documented in users.conf.
|
|
|
|
*/
|
2017-09-18 16:08:21 +02:00
|
|
|
void addPasswordCheck( const QString& key, const QVariant& value );
|
|
|
|
|
2014-07-31 14:52:05 +02:00
|
|
|
protected slots:
|
2014-08-13 17:16:54 +02:00
|
|
|
void onFullNameTextEdited( const QString& );
|
|
|
|
void fillSuggestions();
|
|
|
|
void onUsernameTextEdited( const QString& );
|
|
|
|
void validateUsernameText( const QString& );
|
|
|
|
void onHostnameTextEdited( const QString& );
|
|
|
|
void validateHostnameText( const QString& );
|
2014-07-31 14:52:05 +02:00
|
|
|
void onPasswordTextChanged( const QString& );
|
|
|
|
void onRootPasswordTextChanged( const QString& );
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void checkReady( bool );
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::Page_UserSetup* ui;
|
2014-08-13 17:16:54 +02:00
|
|
|
|
2018-01-23 13:02:49 +01:00
|
|
|
PasswordCheckList m_passwordChecks;
|
2017-09-18 16:08:21 +02:00
|
|
|
|
2015-02-17 20:20:20 +01:00
|
|
|
const QRegExp USERNAME_RX = QRegExp( "^[a-z_][a-z0-9_-]*[$]?$" );
|
2016-02-23 09:32:29 +01:00
|
|
|
const QRegExp HOSTNAME_RX = QRegExp( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
2015-02-17 20:20:20 +01:00
|
|
|
const int USERNAME_MAX_LENGTH = 31;
|
|
|
|
const int HOSTNAME_MIN_LENGTH = 2;
|
2017-06-19 09:02:41 +02:00
|
|
|
const int HOSTNAME_MAX_LENGTH = 63;
|
2014-08-13 17:16:54 +02:00
|
|
|
|
|
|
|
bool m_readyFullName;
|
2014-07-31 14:52:05 +02:00
|
|
|
bool m_readyUsername;
|
2014-08-13 17:16:54 +02:00
|
|
|
bool m_customUsername;
|
2014-07-31 14:52:05 +02:00
|
|
|
bool m_readyHostname;
|
2014-08-13 17:16:54 +02:00
|
|
|
bool m_customHostname;
|
2014-07-31 14:52:05 +02:00
|
|
|
bool m_readyPassword;
|
|
|
|
bool m_readyRootPassword;
|
|
|
|
|
2015-11-20 16:27:32 +01:00
|
|
|
bool m_writeRootPassword;
|
2014-07-31 14:52:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // USERSPAGE_H
|