Fix password reset stuff (got reverted somehow)
This commit is contained in:
@@ -1016,27 +1016,41 @@ function checkAccountResetPasswordRequest(client, inputText) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_NONE) {
|
switch(getPlayerData(client).passwordResetState) {
|
||||||
if(toLowerCase(getPlayerData(client).accountData.emailAddress) != toLowerCase(inputText)) {
|
case VRR_RESETPASS_STATE_EMAILCONFIRM: {
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (email not correct)`);
|
if(toLowerCase(getPlayerData(client).accountData.emailAddress) != toLowerCase(inputText)) {
|
||||||
return false;
|
logToConsole(LOG_INFO|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (email not correct)`);
|
||||||
|
showPlayerErrorGUI(client, getLocaleString(client, "GUIErrorResetPasswordFailedInvalidEmail"), getLocaleString(client, "GUIErrorTitle"), getLocaleString(client, "GUIOkButton"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let passwordResetCode = toUpperCase(generateEmailVerificationCode());
|
||||||
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_CODEINPUT;
|
||||||
|
getPlayerData(client).passwordResetCode = passwordResetCode;
|
||||||
|
showPlayerResetPasswordCodeInputGUI(client);
|
||||||
|
sendPasswordResetEmail(client, passwordResetCode);
|
||||||
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} submitted successful email for password reset. Sending email and awaiting verification code input ...`);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let passwordResetCode = toUpperCase(generateEmailVerificationCode());
|
case VRR_RESETPASS_STATE_CODEINPUT: {
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_CODEINPUT;
|
if(getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
||||||
getPlayerData(client).passwordResetCode = passwordResetCode;
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
||||||
sendPasswordResetEmail(client, passwordResetCode);
|
showPlayerChangePasswordGUI(client, getLocaleString(client));
|
||||||
showPlayerResetPasswordCodeInputGUI(client);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} reset their password. Awaiting verification code input ...`);
|
} else {
|
||||||
} else if(getPlayerData(client).passwordResetState == VRR_RESETPASS_STATE_CODEINPUT) {
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
|
||||||
if(getPlayerData(client).passwordResetCode == toUpperCase(inputText)) {
|
disconnectPlayer(client);
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_SETPASS;
|
logToConsole(LOG_INFO|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct)`);
|
||||||
showPlayerChangePasswordGUI(client);
|
}
|
||||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} entered the correct reset password verification code. Awaiting new password input ...`);
|
break;
|
||||||
} else {
|
}
|
||||||
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_NONE;
|
|
||||||
disconnectPlayer(client);
|
case VRR_RESETPASS_STATE_NONE: {
|
||||||
logToConsole(LOG_DEBUG|LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to reset their password (verification code not correct)`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} requested a password reset. Awaiting email input ...`);
|
||||||
|
showPlayerResetPasswordEmailInputGUI(client);
|
||||||
|
getPlayerData(client).passwordResetState = VRR_RESETPASS_STATE_EMAILCONFIRM;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user