Fix reset password bug
This commit is contained in:
@@ -82,7 +82,7 @@ function initResetPasswordGUI() {
|
|||||||
});
|
});
|
||||||
passwordReset.emailInput.placeholder = "Email";
|
passwordReset.emailInput.placeholder = "Email";
|
||||||
|
|
||||||
passwordReset.resetPasswordButton = passwordReset.window.button(180, 240, 100, 15, 'RESET PASSWORD', {
|
passwordReset.resetPasswordButton = passwordReset.window.button(20, 205, 260, 30, 'RESET PASSWORD', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
@@ -141,7 +141,7 @@ function showResetPasswordGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkResetPassword() {
|
function checkResetPassword() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server ...`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
||||||
sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
|
sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ function resetPasswordCodeInputGUI() {
|
|||||||
|
|
||||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
||||||
//passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
//passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
passwordReset.emailInput.text = "";
|
passwordReset.emailInput.lines[0] = "";
|
||||||
passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordCodePlaceholder");
|
passwordReset.emailInput.placeholder = getLocaleString("GUIResetPasswordCodePlaceholder");
|
||||||
|
|
||||||
guiSubmitKey = checkResetPassword;
|
guiSubmitKey = checkResetPassword;
|
||||||
|
|||||||
@@ -801,9 +801,10 @@ function createAccount(name, password, email = "") {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkLogin(client, password) {
|
async function checkLogin(client, password) {
|
||||||
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
|
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining - 1;
|
||||||
if (getPlayerData(client).loginAttemptsRemaining <= 0) {
|
if (getPlayerData(client).loginAttemptsRemaining <= 0) {
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,7 +843,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
// sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
// await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
//}
|
//}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -859,7 +860,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
// sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
// await sendAccountLoginFailedNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
//}
|
//}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -879,7 +880,7 @@ function checkLogin(client, password) {
|
|||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
//if (isAccountEmailVerified(getPlayerData(client).accountData) && !isAccountSettingFlagEnabled(getPlayerData(client).accountData, getAccountSettingsFlagValue("AuthAttemptAlert"))) {
|
||||||
// sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
// await sendAccountLoginSuccessNotification(getPlayerData(client).accountData.emailAddress, getPlayerName(client), getPlayerIP(client), getGame());
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -987,6 +988,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
|
|
||||||
if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
if (doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Not a tester";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
@@ -1032,22 +1034,23 @@ function checkAccountResetPasswordRequest(client, inputText) {
|
|||||||
getPlayerData(client).passwordResetCode = passwordResetCode;
|
getPlayerData(client).passwordResetCode = passwordResetCode;
|
||||||
showPlayerResetPasswordCodeInputGUI(client);
|
showPlayerResetPasswordCodeInputGUI(client);
|
||||||
sendPasswordResetEmail(client, passwordResetCode);
|
sendPasswordResetEmail(client, passwordResetCode);
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input ...`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input (${passwordResetCode}) ...`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VRR_RESETPASS_STATE_CODEINPUT: {
|
case VRR_RESETPASS_STATE_CODEINPUT: {
|
||||||
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted code for password reset (${inputText}) ...`);
|
||||||
if (inputText != "") {
|
if (inputText != "") {
|
||||||
if (getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
if (getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
||||||
showPlayerChangePasswordGUI(client, getLocaleString(client));
|
showPlayerChangePasswordGUI(client);
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
|
|
||||||
getPlayerData(client).passwordResetAttemptsRemaining = getPlayerData(client).passwordResetAttemptsRemaining - 1;
|
getPlayerData(client).passwordResetAttemptsRemaining = getPlayerData(client).passwordResetAttemptsRemaining - 1;
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
|
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, ${getPlayerData(client).passwordResetAttemptsRemaining} attempts remaining)`);
|
||||||
if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
|
if (getPlayerData(client).passwordResetAttemptsRemaining <= 0) {
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
|
logToConsole(LOG_INFO | LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct, no more attempts remaining, kicking ...)`);
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1570,6 +1573,7 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPlayerData(client).customDisconnectReason = "Kicked - Failed to login";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user