#5657 Removed password log in in activation window
This commit is contained in:
parent
a6ff90794f
commit
fc879323bc
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>440</width>
|
<width>440</width>
|
||||||
<height>314</height>
|
<height>214</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="m_pRadioButtonActivate">
|
<widget class="QLabel" name="label">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
|
@ -23,76 +23,7 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Account login</string>
|
<string>Serial key</string>
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="m_pLabelEmail">
|
|
||||||
<property name="text">
|
|
||||||
<string>Email:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditEmail">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Normal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Password:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="m_pLineEditPassword">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Password</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="m_pRadioButtonSubscription">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Serial key</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -109,20 +40,33 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="m_pTextEditSerialKey">
|
<widget class="QTextEdit" name="m_pTextEditSerialKey">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="html">
|
<property name="html">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -20,26 +20,8 @@ ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig) :
|
||||||
m_appConfig (&appConfig)
|
m_appConfig (&appConfig)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->m_pLineEditEmail->setText(appConfig.activateEmail());
|
|
||||||
ui->m_pTextEditSerialKey->setText(appConfig.serialKey());
|
|
||||||
|
|
||||||
if (!appConfig.serialKey().isEmpty()) {
|
|
||||||
ui->m_pRadioButtonActivate->setAutoExclusive(false);
|
|
||||||
ui->m_pRadioButtonSubscription->setAutoExclusive(false);
|
|
||||||
ui->m_pRadioButtonActivate->setChecked(false);
|
|
||||||
ui->m_pRadioButtonSubscription->setChecked(true);
|
|
||||||
ui->m_pRadioButtonActivate->setAutoExclusive(true);
|
|
||||||
ui->m_pRadioButtonSubscription->setAutoExclusive(true);
|
|
||||||
ui->m_pTextEditSerialKey->setFocus();
|
ui->m_pTextEditSerialKey->setFocus();
|
||||||
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
|
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
|
||||||
} else {
|
|
||||||
if (ui->m_pLineEditEmail->text().isEmpty()) {
|
|
||||||
ui->m_pLineEditEmail->setFocus();
|
|
||||||
} else {
|
|
||||||
ui->m_pLineEditPassword->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivationDialog::~ActivationDialog()
|
ActivationDialog::~ActivationDialog()
|
||||||
|
@ -74,30 +56,6 @@ void ActivationDialog::reject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivationDialog::on_m_pRadioButtonSubscription_toggled(bool checked)
|
|
||||||
{
|
|
||||||
if (checked) {
|
|
||||||
ui->m_pLineEditEmail->setEnabled(false);
|
|
||||||
ui->m_pLineEditPassword->setEnabled(false);
|
|
||||||
ui->m_pTextEditSerialKey->setEnabled(true);
|
|
||||||
ui->m_pTextEditSerialKey->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivationDialog::on_m_pRadioButtonActivate_toggled(bool checked)
|
|
||||||
{
|
|
||||||
if (checked) {
|
|
||||||
ui->m_pLineEditEmail->setEnabled(true);
|
|
||||||
ui->m_pLineEditPassword->setEnabled(true);
|
|
||||||
ui->m_pTextEditSerialKey->setEnabled(false);
|
|
||||||
if (ui->m_pLineEditEmail->text().isEmpty()) {
|
|
||||||
ui->m_pLineEditEmail->setFocus();
|
|
||||||
} else {
|
|
||||||
ui->m_pLineEditPassword->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivationDialog::accept()
|
void ActivationDialog::accept()
|
||||||
{
|
{
|
||||||
QMessageBox message;
|
QMessageBox message;
|
||||||
|
@ -108,35 +66,10 @@ void ActivationDialog::accept()
|
||||||
m_appConfig->saveSettings();
|
m_appConfig->saveSettings();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (ui->m_pRadioButtonActivate->isChecked()) {
|
|
||||||
WebClient webClient;
|
|
||||||
QString email = ui->m_pLineEditEmail->text();
|
|
||||||
QString password = ui->m_pLineEditPassword->text();
|
|
||||||
|
|
||||||
if (!webClient.setEmail (email, error)) {
|
|
||||||
message.critical (this, "Invalid Email Address", tr("%1").arg(error));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!webClient.setPassword (password, error)) {
|
|
||||||
message.critical (this, "Invalid Password", tr("%1").arg(error));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!webClient.getEdition (edition, error)) {
|
|
||||||
FailedLoginDialog failedLoginDialog (this, error);
|
|
||||||
failedLoginDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_appConfig->setActivateEmail (email);
|
|
||||||
m_appConfig->clearSerialKey();
|
|
||||||
ui->m_pTextEditSerialKey->clear();
|
|
||||||
notifyActivation ("login:" + m_appConfig->activateEmail());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QString serialKey = ui->m_pTextEditSerialKey->toPlainText();
|
QString serialKey = ui->m_pTextEditSerialKey->toPlainText();
|
||||||
|
|
||||||
if (!m_appConfig->setSerialKey (serialKey, error)) {
|
if (!m_appConfig->setSerialKey (serialKey, error)) {
|
||||||
message.critical (this, "Invalid Serial Key", tr("%1").arg(error));
|
message.critical(this, "Invalid Serial Key", tr("%1").arg(error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +78,8 @@ void ActivationDialog::accept()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_appConfig->setActivateEmail("");
|
m_appConfig->setActivateEmail("");
|
||||||
notifyActivation ("serial:" + m_appConfig->serialKey());
|
notifyActivation("serial:" + m_appConfig->serialKey());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
message.critical (this, "Unknown Error",
|
message.critical (this, "Unknown Error",
|
||||||
|
@ -159,7 +92,7 @@ void ActivationDialog::accept()
|
||||||
m_appConfig->setEdition(edition);
|
m_appConfig->setEdition(edition);
|
||||||
m_appConfig->saveSettings();
|
m_appConfig->saveSettings();
|
||||||
|
|
||||||
message.information (this, "Activated!",
|
message.information(this, "Activated!",
|
||||||
tr("Thanks for activating %1!").arg (getEditionName (edition)));
|
tr("Thanks for activating %1!").arg (getEditionName (edition)));
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
Ui::ActivationDialog *ui;
|
Ui::ActivationDialog *ui;
|
||||||
AppConfig* m_appConfig;
|
AppConfig* m_appConfig;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_m_pRadioButtonSubscription_toggled(bool checked);
|
|
||||||
void on_m_pRadioButtonActivate_toggled(bool checked);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ACTIVATIONDIALOG_H
|
#endif // ACTIVATIONDIALOG_H
|
||||||
|
|
Loading…
Reference in New Issue