diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-05-31 19:48:41 +0200 |
---|---|---|
committer | Sefa Eyeoglu <contact@scrumplex.net> | 2022-07-08 16:25:03 +0200 |
commit | 311b081e601df907378736011a50424087a5d60b (patch) | |
tree | 6978c5d45733ac7fe00ff4fdd0388a03c4bd4cfc | |
parent | 4103948132636fcb01daa866f107259a821419dd (diff) | |
download | PrismLauncher-311b081e601df907378736011a50424087a5d60b.tar.gz PrismLauncher-311b081e601df907378736011a50424087a5d60b.tar.bz2 PrismLauncher-311b081e601df907378736011a50424087a5d60b.zip |
feat: add validation for Flame key and MSA client ID
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
-rw-r--r-- | launcher/ui/pages/global/APIPage.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 93a265e3..e3d30475 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -40,8 +40,10 @@ #include <QMessageBox> #include <QFileDialog> +#include <QRegularExpression> #include <QStandardPaths> #include <QTabBar> +#include <QValidator> #include <QVariant> #include "settings/SettingsObject.h" @@ -63,6 +65,10 @@ APIPage::APIPage(QWidget *parent) : }; static QRegularExpression validUrlRegExp("https?://.+"); + static QRegularExpression validMSAClientID(QRegularExpression::anchoredPattern( + "[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}")); + static QRegularExpression validFlameKey(QRegularExpression::anchoredPattern( + "\\$2[ayb]\\$.{56}")); ui->setupUi(this); @@ -75,6 +81,8 @@ APIPage::APIPage(QWidget *parent) : // This function needs to be called even when the ComboBox's index is still in its default state. updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex()); ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry)); + ui->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID)); + ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey)); ui->metaURL->setPlaceholderText(BuildConfig.META_URL); ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT); |