Skip to content

Commit

Permalink
Validate email address in researcher wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
a123b committed Aug 19, 2020
1 parent bdf80f6 commit 2f3eddb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/qt/researcher/researcherwizardemailpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ ResearcherWizardEmailPage::ResearcherWizardEmailPage(QWidget *parent)
{
ui->setupUi(this);

// Validate email with the same pattern as the BOINC server
QRegularExpression boincEmailRegexp("^([^@]+)@([^@\\.]+)\\.([^@]{2,})$");
boincEmailValidator = new QRegularExpressionValidator(boincEmailRegexp, this);
ui->emailAddressLineEdit->setValidator(boincEmailValidator);

// The asterisk denotes a mandatory field:
registerField("emailAddress*", ui->emailAddressLineEdit);
}

ResearcherWizardEmailPage::~ResearcherWizardEmailPage()
{
delete boincEmailValidator;
delete ui;
}

Expand Down
2 changes: 2 additions & 0 deletions src/qt/researcher/researcherwizardemailpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define RESEARCHERWIZARDEMAILPAGE_H

#include <QWizardPage>
#include <QRegularExpressionValidator>

class ResearcherModel;

Expand All @@ -24,6 +25,7 @@ class ResearcherWizardEmailPage : public QWizardPage
private:
Ui::ResearcherWizardEmailPage *ui;
ResearcherModel *m_model;
QRegularExpressionValidator *boincEmailValidator;
};

#endif // RESEARCHERWIZARDEMAILPAGE_H

0 comments on commit 2f3eddb

Please sign in to comment.