#930 Change captcha storage to change code internally upon failure

- Within CaptchaStorage#checkCode, a player's captcha code is overridden with a new one on failure or cleared on success
- Fixes inconsistencies in the retrieval / regeneration of codes
This commit is contained in:
ljacqu
2018-01-06 02:31:26 +01:00
parent 180bbbf0be
commit 84b376d2a5
8 changed files with 48 additions and 34 deletions
@@ -53,7 +53,7 @@ public class CaptchaCommand extends PlayerCommand {
commonService.send(player, MessageKey.LOGIN_MESSAGE);
limboService.unmuteMessageTask(player);
} else {
String newCode = loginCaptchaManager.generateCode(player.getName());
String newCode = loginCaptchaManager.getCaptchaCodeOrGenerateNew(player.getName());
commonService.send(player, MessageKey.CAPTCHA_WRONG_ERROR, newCode);
}
}
@@ -64,7 +64,7 @@ public class CaptchaCommand extends PlayerCommand {
commonService.send(player, MessageKey.CAPTCHA_SUCCESS);
commonService.send(player, MessageKey.REGISTER_MESSAGE);
} else {
String newCode = registrationCaptchaManager.generateCode(player.getName());
String newCode = registrationCaptchaManager.getCaptchaCodeOrGenerateNew(player.getName());
commonService.send(player, MessageKey.CAPTCHA_WRONG_ERROR, newCode);
}
}