work with old qt
This commit is contained in:
parent
d76301cfcd
commit
5dd834c3af
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -10,7 +10,7 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
build-linux:
|
build-linux:
|
||||||
# The type of runner that the job will run on
|
# The type of runner that the job will run on
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
|
#endif
|
||||||
|
|
||||||
class Server;
|
class Server;
|
||||||
|
|
||||||
|
@ -164,7 +164,14 @@ void AOClient::cmdSetRootPass(int argc, QStringList argv)
|
|||||||
settings.beginGroup("Options");
|
settings.beginGroup("Options");
|
||||||
settings.setValue("auth", "advanced");
|
settings.setValue("auth", "advanced");
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
qsrand(QDateTime::currentMSecsSinceEpoch());
|
||||||
|
quint32 upper_salt = qrand();
|
||||||
|
quint32 lower_salt = qrand();
|
||||||
|
quint64 salt_number = (upper_salt << 32) | lower_salt;
|
||||||
|
#else
|
||||||
quint64 salt_number = QRandomGenerator::system()->generate64();
|
quint64 salt_number = QRandomGenerator::system()->generate64();
|
||||||
|
#endif
|
||||||
QString salt = QStringLiteral("%1").arg(salt_number, 16, 16, QLatin1Char('0'));
|
QString salt = QStringLiteral("%1").arg(salt_number, 16, 16, QLatin1Char('0'));
|
||||||
|
|
||||||
server->db_manager->createUser("root", salt, argv[0], ACLFlags.value("SUPER"));
|
server->db_manager->createUser("root", salt, argv[0], ACLFlags.value("SUPER"));
|
||||||
@ -206,7 +213,14 @@ void AOClient::cmdBgUnlock(int argc, QStringList argv)
|
|||||||
|
|
||||||
void AOClient::cmdAddUser(int argc, QStringList argv)
|
void AOClient::cmdAddUser(int argc, QStringList argv)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
qsrand(QDateTime::currentMSecsSinceEpoch());
|
||||||
|
quint32 upper_salt = qrand();
|
||||||
|
quint32 lower_salt = qrand();
|
||||||
|
quint64 salt_number = (upper_salt << 32) | lower_salt;
|
||||||
|
#else
|
||||||
quint64 salt_number = QRandomGenerator::system()->generate64();
|
quint64 salt_number = QRandomGenerator::system()->generate64();
|
||||||
|
#endif
|
||||||
QString salt = QStringLiteral("%1").arg(salt_number, 16, 16, QLatin1Char('0'));
|
QString salt = QStringLiteral("%1").arg(salt_number, 16, 16, QLatin1Char('0'));
|
||||||
|
|
||||||
if (server->db_manager->createUser(argv[0], salt, argv[1], ACLFlags.value("NONE")))
|
if (server->db_manager->createUser(argv[0], salt, argv[1], ACLFlags.value("NONE")))
|
||||||
|
Loading…
Reference in New Issue
Block a user