Skip to content

Commit

Permalink
Remove use of deprecated qrand() function in favor of QRandomGenerato…
Browse files Browse the repository at this point in the history
…r in the oauth2 authentication method
  • Loading branch information
nirvn committed Jul 17, 2021
1 parent 81e412c commit 1edf16d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/auth/oauth2/core/qgso2.cpp
Expand Up @@ -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" );

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 1edf16d

Please sign in to comment.