pass reset Small fixes (#4310)

This commit is contained in:
tooomm 2021-04-12 19:28:47 +02:00 committed by GitHub
parent 7d1f082b27
commit 88a8ee09bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 34 additions and 36 deletions

View file

@ -88,7 +88,7 @@ DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
btnForgotPassword = new QPushButton(this); btnForgotPassword = new QPushButton(this);
btnForgotPassword->setIcon(QPixmap("theme:icons/forgot_password")); btnForgotPassword->setIcon(QPixmap("theme:icons/forgot_password"));
btnForgotPassword->setToolTip(tr("Forgot Password")); btnForgotPassword->setToolTip(tr("Reset Password"));
btnForgotPassword->setFixedWidth(30); btnForgotPassword->setFixedWidth(30);
connect(btnForgotPassword, SIGNAL(released()), this, SLOT(actForgotPassword())); connect(btnForgotPassword, SIGNAL(released()), this, SLOT(actForgotPassword()));

View file

@ -27,9 +27,8 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
} }
if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) { if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) {
QMessageBox::warning(this, tr("Forgot Password Challenge Warning"), QMessageBox::warning(this, tr("Reset Password Challenge Warning"),
tr("Oops, looks like something has gone wrong. Please restart the forgot password " tr("A problem has occurred. Please try to request a new password again."));
"process by using the forgot password button on the connection screen."));
reject(); reject();
} }
@ -82,7 +81,7 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Forgot Password Challenge")); setWindowTitle(tr("Reset Password Challenge"));
setFixedHeight(sizeHint().height()); setFixedHeight(sizeHint().height());
setMinimumWidth(300); setMinimumWidth(300);
} }
@ -90,7 +89,7 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
void DlgForgotPasswordChallenge::actOk() void DlgForgotPasswordChallenge::actOk()
{ {
if (emailEdit->text().isEmpty()) { if (emailEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Forgot Password Challenge Warning"), tr("The email address can't be empty.")); QMessageBox::critical(this, tr("Reset Password Challenge Error"), tr("The email address can't be empty."));
return; return;
} }

View file

@ -59,7 +59,7 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Forgot Password Request")); setWindowTitle(tr("Reset Password Request"));
setFixedHeight(sizeHint().height()); setFixedHeight(sizeHint().height());
setMinimumWidth(300); setMinimumWidth(300);
} }
@ -67,7 +67,7 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa
void DlgForgotPasswordRequest::actOk() void DlgForgotPasswordRequest::actOk()
{ {
if (playernameEdit->text().isEmpty()) { if (playernameEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Forgot Password Request Warning"), tr("The player name can't be empty.")); QMessageBox::critical(this, tr("Reset Password Error"), tr("The player name can't be empty."));
return; return;
} }

View file

@ -27,9 +27,8 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
} }
if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) { if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) {
QMessageBox::warning(this, tr("Forgot Password Reset Warning"), QMessageBox::warning(this, tr("Reset Password Warning"),
tr("Oops, looks like something has gone wrong. Please re-start the forgot password " tr("A problem has occurred. Please try to request a new password again."));
"process by using the forgot password button on the connection screen."));
reject(); reject();
} }
@ -95,7 +94,7 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Forgot Password Reset")); setWindowTitle(tr("Reset Password"));
setFixedHeight(sizeHint().height()); setFixedHeight(sizeHint().height());
setMinimumWidth(300); setMinimumWidth(300);
} }
@ -103,22 +102,22 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
void DlgForgotPasswordReset::actOk() void DlgForgotPasswordReset::actOk()
{ {
if (playernameEdit->text().isEmpty()) { if (playernameEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Forgot Password Reset Warning"), tr("The player name can't be empty.")); QMessageBox::critical(this, tr("Reset Password Error"), tr("The player name can't be empty."));
return; return;
} }
if (tokenEdit->text().isEmpty()) { if (tokenEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Forgot Password Reset Warning"), tr("The token can't be empty.")); QMessageBox::critical(this, tr("Reset Password Error"), tr("The token can't be empty."));
return; return;
} }
if (newpasswordEdit->text().isEmpty()) { if (newpasswordEdit->text().isEmpty()) {
QMessageBox::critical(this, tr("Forgot Password Reset Warning"), tr("The new password can't be empty.")); QMessageBox::critical(this, tr("Reset Password Error"), tr("The new password can't be empty."));
return; return;
} }
if (newpasswordEdit->text() != newpasswordverifyEdit->text()) { if (newpasswordEdit->text() != newpasswordverifyEdit->text()) {
QMessageBox::critical(this, tr("Forgot Password Reset Warning"), tr("The passwords do not match.")); QMessageBox::critical(this, tr("Reset Password Error"), tr("The passwords do not match."));
return; return;
} }

View file

@ -129,7 +129,7 @@ WndSets::WndSets(QWidget *parent) : QMainWindow(parent)
labNotes->setWordWrap(true); labNotes->setWordWrap(true);
labNotes->setTextInteractionFlags(Qt::TextBrowserInteraction); labNotes->setTextInteractionFlags(Qt::TextBrowserInteraction);
labNotes->setOpenExternalLinks(true); labNotes->setOpenExternalLinks(true);
labNotes->setText(tr("Use ctrl+a to select all sets in the view.") + "<br><b>" + tr("Deck Editor") + ":</b> " + labNotes->setText(tr("Use CTRL+A to select all sets in the view.") + "<br><b>" + tr("Deck Editor") + ":</b> " +
tr("Only cards in enabled sets will appear in the card list of the deck editor.") + "<br><b>" + tr("Only cards in enabled sets will appear in the card list of the deck editor.") + "<br><b>" +
tr("Card Art") + ":</b> " + tr("Image priority is decided in the following order:") + "<br>" + tr("Card Art") + ":</b> " + tr("Image priority is decided in the following order:") + "<br>" +
tr("first the CUSTOM Folder (%1), then the Enabled Sets in this dialog (Top to Bottom)", tr("first the CUSTOM Folder (%1), then the Enabled Sets in this dialog (Top to Bottom)",

View file

@ -1321,7 +1321,7 @@ void MainWindow::actForgotPasswordRequest()
void MainWindow::forgotPasswordSuccess() void MainWindow::forgotPasswordSuccess()
{ {
QMessageBox::information( QMessageBox::information(
this, tr("Forgot Password"), this, tr("Reset Password"),
tr("Your password has been reset successfully, you can now log in using the new credentials.")); tr("Your password has been reset successfully, you can now log in using the new credentials."));
SettingsCache::instance().servers().setFPHostName(""); SettingsCache::instance().servers().setFPHostName("");
SettingsCache::instance().servers().setFPPort(""); SettingsCache::instance().servers().setFPPort("");
@ -1331,7 +1331,7 @@ void MainWindow::forgotPasswordSuccess()
void MainWindow::forgotPasswordError() void MainWindow::forgotPasswordError()
{ {
QMessageBox::warning( QMessageBox::warning(
this, tr("Forgot Password"), this, tr("Reset Password"),
tr("Failed to reset user account password, please contact the server operator to reset your password.")); tr("Failed to reset user account password, please contact the server operator to reset your password."));
SettingsCache::instance().servers().setFPHostName(""); SettingsCache::instance().servers().setFPHostName("");
SettingsCache::instance().servers().setFPPort(""); SettingsCache::instance().servers().setFPPort("");
@ -1340,7 +1340,7 @@ void MainWindow::forgotPasswordError()
void MainWindow::promptForgotPasswordReset() void MainWindow::promptForgotPasswordReset()
{ {
QMessageBox::information(this, tr("Forgot Password"), QMessageBox::information(this, tr("Reset Password"),
tr("Activation request received, please check your email for an activation token.")); tr("Activation request received, please check your email for an activation token."));
DlgForgotPasswordReset dlg(this); DlgForgotPasswordReset dlg(this);
if (dlg.exec()) { if (dlg.exec()) {

View file

@ -166,27 +166,27 @@ minpasswordlength = 6
[forgotpassword] [forgotpassword]
; Servatrice can process forgot password requests allowing users to reset their account ; Servatrice can process reset password requests allowing users to reset their account
; passwords in the event they forget it. Should this feature be enabled? Default: false. ; passwords in the event they forget it. Should this feature be enabled? Default: false.
; enable=false ; enable=false
; Forgot password request should not be allowed to stay valid forever. This settings ; Reset password request should not be allowed to stay valid forever. This settings
; informs servatrice how long a players forgot password reset token is valid for (in minutes). ; informs servatrice how long a players reset password reset token is valid for (in minutes).
; Default: 60 ; Default: 60
; tokenlife=60 ; tokenlife=60
; Servatrice can challenge users that are making forgot password requests to answer ; Servatrice can challenge users that are making reset password requests to answer
; questions in regards to their account to help validate they are the true owner of the account. ; questions in regards to their account to help validate they are the true owner of the account.
; Should this feature be enabled? Default: false ; Should this feature be enabled? Default: false
; enablechallenge=false ; enablechallenge=false
; Email subject for the forgot password emails ; Email subject for the reset password emails
; subject="Cockatrice forgot password token" ; subject="Cockatrice reset password token"
; Forgot password email body. You can use these tags here: %username %token ; Reset password email body. You can use these tags here: %username %token
; They will be substituted with the actual values in the email ; They will be substituted with the actual values in the email
; ;
; body="Hi %username, sorry to hear you forgot your password on our Cockatrice server\r\nHere's the token to use to reset your account password:\r\n\r\n%token\r\n\r\nHappy gaming!" ; body="Hi %username,\r\nthanks for reaching out to us with your password reset request for our Cockatrice server.\r\nHere's your unique token in order to reset your account password in the app:\r\n\r\n%token\r\n\r\nHappy gaming!"
[smtp] [smtp]

View file

@ -285,16 +285,16 @@ bool Servatrice::initServer()
} }
} }
qDebug() << "Forgot password enabled: " << getEnableForgotPassword(); qDebug() << "Reset password enabled: " << getEnableForgotPassword();
if (getEnableForgotPassword()) { if (getEnableForgotPassword()) {
qDebug() << "Forgot password token life (in minutes): " << getForgotPasswordTokenLife(); qDebug() << "Reset password token life (in minutes): " << getForgotPasswordTokenLife();
qDebug() << "Forgot password challenge on: " << getEnableForgotPasswordChallenge(); qDebug() << "Reset password challenge on: " << getEnableForgotPasswordChallenge();
} }
qDebug() << "Auditing enabled: " << getEnableAudit(); qDebug() << "Auditing enabled: " << getEnableAudit();
if (getEnableAudit()) { if (getEnableAudit()) {
qDebug() << "Audit registration attempts enabled: " << getEnableRegistrationAudit(); qDebug() << "Audit registration attempts enabled: " << getEnableRegistrationAudit();
qDebug() << "Audit forgot password attepts enabled: " << getEnableForgotPasswordAudit(); qDebug() << "Audit reset password attepts enabled: " << getEnableForgotPasswordAudit();
} }
if (getDBTypeString() == "mysql") { if (getDBTypeString() == "mysql") {

View file

@ -1249,7 +1249,7 @@ Response::ResponseCode AbstractServerSocketInterface::cmdAccountPassword(const C
Response::ResponseCode AbstractServerSocketInterface::cmdForgotPasswordRequest(const Command_ForgotPasswordRequest &cmd, Response::ResponseCode AbstractServerSocketInterface::cmdForgotPasswordRequest(const Command_ForgotPasswordRequest &cmd,
ResponseContainer &rc) ResponseContainer &rc)
{ {
qDebug() << "Received forgot password request from user: " << QString::fromStdString(cmd.user_name()); qDebug() << "Received reset password request from user: " << QString::fromStdString(cmd.user_name());
if (!servatrice->getEnableForgotPassword()) { if (!servatrice->getEnableForgotPassword()) {
if (servatrice->getEnableForgotPasswordAudit()) if (servatrice->getEnableForgotPasswordAudit())
@ -1327,7 +1327,7 @@ Response::ResponseCode AbstractServerSocketInterface::cmdForgotPasswordReset(con
ResponseContainer &rc) ResponseContainer &rc)
{ {
Q_UNUSED(rc); Q_UNUSED(rc);
qDebug() << "Received forgot password reset from user: " << QString::fromStdString(cmd.user_name()); qDebug() << "Received reset password reset from user: " << QString::fromStdString(cmd.user_name());
if (!sqlInterface->doesForgotPasswordExist(QString::fromStdString(cmd.user_name()))) { if (!sqlInterface->doesForgotPasswordExist(QString::fromStdString(cmd.user_name()))) {
if (servatrice->getEnableForgotPasswordAudit()) if (servatrice->getEnableForgotPasswordAudit())
@ -1367,7 +1367,7 @@ AbstractServerSocketInterface::cmdForgotPasswordChallenge(const Command_ForgotPa
ResponseContainer &rc) ResponseContainer &rc)
{ {
Q_UNUSED(rc); Q_UNUSED(rc);
qDebug() << "Received forgot password challenge from user: " << QString::fromStdString(cmd.user_name()); qDebug() << "Received reset password challenge from user: " << QString::fromStdString(cmd.user_name());
if (sqlInterface->doesForgotPasswordExist(QString::fromStdString(cmd.user_name()))) { if (sqlInterface->doesForgotPasswordExist(QString::fromStdString(cmd.user_name()))) {
if (servatrice->getEnableForgotPasswordAudit()) if (servatrice->getEnableForgotPasswordAudit())

View file

@ -63,7 +63,7 @@ To learn React, check out the [React documentation](https://reactjs.org/).
6) Account page 6) Account page
7) Register/Forgot Passoword forms 7) Register/Reset Password forms
8) Message User 8) Message User