Skip to content
Permalink
Browse files
Remove use of deprecated qrand() function in favor of QRandomGenerato…
…r in the oauth2 authentication method
  • Loading branch information
nirvn committed Jul 17, 2021
1 parent 81e412c commit 1edf16d911bbe93dddf2dfb9cebfa19fe24d5508
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/auth/oauth2/core/qgso2.cpp
@@ -30,6 +30,9 @@
#include <QUrl>
#include <QUrlQuery>

#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
#include <QRandomGenerator>
#endif

QString QgsO2::O2_OAUTH2_STATE = QStringLiteral( "state" );

@@ -250,8 +253,12 @@ void QgsO2::link()

void QgsO2::setState( const QString & )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
qsrand( QTime::currentTime().msec() );
state_ = QString::number( qrand() );
#else
state_ = QString::number( QRandomGenerator::system()->generate() );
#endif
Q_EMIT stateChanged();
}

0 comments on commit 1edf16d

Please sign in to comment.