Print the "Forgot your password? ..." message only if the user has set the recovery email address #1329

This commit is contained in:
Gabriele C 2017-09-14 18:24:14 +02:00
parent f13daff0c7
commit e1466425a1

View File

@ -168,7 +168,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
if (passwordSecurity.comparePassword(password, auth.getPassword(), player.getName())) { if (passwordSecurity.comparePassword(password, auth.getPassword(), player.getName())) {
return true; return true;
} else { } else {
handleWrongPassword(player, ip); handleWrongPassword(player, auth, ip);
return false; return false;
} }
} }
@ -177,9 +177,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
* Handles a login with wrong password. * Handles a login with wrong password.
* *
* @param player the player who attempted to log in * @param player the player who attempted to log in
* @param auth the PlayerAuth object of the player
* @param ip the ip address of the player * @param ip the ip address of the player
*/ */
private void handleWrongPassword(Player player, String ip) { private void handleWrongPassword(Player player, PlayerAuth auth, String ip) {
ConsoleLogger.fine(player.getName() + " used the wrong password"); ConsoleLogger.fine(player.getName() + " used the wrong password");
bukkitService.createAndCallEvent(isAsync -> new FailedLoginEvent(player, isAsync)); bukkitService.createAndCallEvent(isAsync -> new FailedLoginEvent(player, isAsync));
@ -196,7 +197,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
limboService.muteMessageTask(player); limboService.muteMessageTask(player);
service.send(player, MessageKey.USAGE_CAPTCHA, service.send(player, MessageKey.USAGE_CAPTCHA,
captchaManager.getCaptchaCodeOrGenerateNew(player.getName())); captchaManager.getCaptchaCodeOrGenerateNew(player.getName()));
} else if (emailService.hasAllInformation()) { } else if (emailService.hasAllInformation() && !auth.getEmail().equals("your@email.com")) {
service.send(player, MessageKey.FORGOT_PASSWORD_MESSAGE); service.send(player, MessageKey.FORGOT_PASSWORD_MESSAGE);
} }
} }