Merge pull request #1254 from ZeldaZach/fix_1248
require pass & email confirmation
This commit is contained in:
commit
d2af7ff99e
2 changed files with 35 additions and 10 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "dlg_register.h"
|
#include "dlg_register.h"
|
||||||
|
@ -33,10 +34,19 @@ DlgRegister::DlgRegister(QWidget *parent)
|
||||||
passwordLabel->setBuddy(passwordEdit);
|
passwordLabel->setBuddy(passwordEdit);
|
||||||
passwordEdit->setEchoMode(QLineEdit::Password);
|
passwordEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
|
passwordConfirmationLabel = new QLabel(tr("Password (again):"));
|
||||||
|
passwordConfirmationEdit = new QLineEdit();
|
||||||
|
passwordConfirmationLabel->setBuddy(passwordConfirmationEdit);
|
||||||
|
passwordConfirmationEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
emailLabel = new QLabel(tr("Email:"));
|
emailLabel = new QLabel(tr("Email:"));
|
||||||
emailEdit = new QLineEdit();
|
emailEdit = new QLineEdit();
|
||||||
emailLabel->setBuddy(emailEdit);
|
emailLabel->setBuddy(emailEdit);
|
||||||
|
|
||||||
|
emailConfirmationLabel = new QLabel(tr("Email (again):"));
|
||||||
|
emailConfirmationEdit = new QLineEdit();
|
||||||
|
emailConfirmationLabel->setBuddy(emailConfirmationEdit);
|
||||||
|
|
||||||
genderLabel = new QLabel(tr("Pronouns:"));
|
genderLabel = new QLabel(tr("Pronouns:"));
|
||||||
genderEdit = new QComboBox();
|
genderEdit = new QComboBox();
|
||||||
genderLabel->setBuddy(genderEdit);
|
genderLabel->setBuddy(genderEdit);
|
||||||
|
@ -69,14 +79,18 @@ DlgRegister::DlgRegister(QWidget *parent)
|
||||||
grid->addWidget(playernameEdit, 2, 1);
|
grid->addWidget(playernameEdit, 2, 1);
|
||||||
grid->addWidget(passwordLabel, 3, 0);
|
grid->addWidget(passwordLabel, 3, 0);
|
||||||
grid->addWidget(passwordEdit, 3, 1);
|
grid->addWidget(passwordEdit, 3, 1);
|
||||||
grid->addWidget(emailLabel, 4, 0);
|
grid->addWidget(passwordConfirmationLabel, 4, 0);
|
||||||
grid->addWidget(emailEdit, 4, 1);
|
grid->addWidget(passwordConfirmationEdit, 4, 1);
|
||||||
grid->addWidget(genderLabel, 5, 0);
|
grid->addWidget(emailLabel, 5, 0);
|
||||||
grid->addWidget(genderEdit, 5, 1);
|
grid->addWidget(emailEdit, 5, 1);
|
||||||
grid->addWidget(countryLabel, 6, 0);
|
grid->addWidget(emailConfirmationLabel, 6, 0);
|
||||||
grid->addWidget(countryEdit, 6, 1);
|
grid->addWidget(emailConfirmationEdit, 6, 1);
|
||||||
grid->addWidget(realnameLabel, 7, 0);
|
grid->addWidget(genderLabel, 7, 0);
|
||||||
grid->addWidget(realnameEdit, 7, 1);
|
grid->addWidget(genderEdit, 7, 1);
|
||||||
|
grid->addWidget(countryLabel, 8, 0);
|
||||||
|
grid->addWidget(countryEdit, 8, 1);
|
||||||
|
grid->addWidget(realnameLabel, 9, 0);
|
||||||
|
grid->addWidget(realnameEdit, 9, 1);
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
||||||
|
@ -94,6 +108,17 @@ DlgRegister::DlgRegister(QWidget *parent)
|
||||||
|
|
||||||
void DlgRegister::actOk()
|
void DlgRegister::actOk()
|
||||||
{
|
{
|
||||||
|
if (passwordEdit->text() != passwordConfirmationEdit->text())
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Registration Warning"), tr("Your passwords do not match, please try again."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (emailConfirmationEdit->text() != emailEdit->text())
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Registration Warning"), tr("Your email addresses do not match, please try again."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("server");
|
settings.beginGroup("server");
|
||||||
settings.setValue("hostname", hostEdit->text());
|
settings.setValue("hostname", hostEdit->text());
|
||||||
|
|
|
@ -25,8 +25,8 @@ private slots:
|
||||||
void actOk();
|
void actOk();
|
||||||
void actCancel();
|
void actCancel();
|
||||||
private:
|
private:
|
||||||
QLabel *hostLabel, *portLabel, *playernameLabel, *passwordLabel, *emailLabel, *genderLabel, *countryLabel, *realnameLabel;
|
QLabel *hostLabel, *portLabel, *playernameLabel, *passwordLabel, *passwordConfirmationLabel, *emailLabel, *emailConfirmationLabel, *genderLabel, *countryLabel, *realnameLabel;
|
||||||
QLineEdit *hostEdit, *portEdit, *playernameEdit, *passwordEdit, *emailEdit, *realnameEdit;
|
QLineEdit *hostEdit, *portEdit, *playernameEdit, *passwordEdit, *passwordConfirmationEdit, *emailEdit, *emailConfirmationEdit, *realnameEdit;
|
||||||
QComboBox *genderEdit, *countryEdit;
|
QComboBox *genderEdit, *countryEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue