From e1466425a19c77dc7261d27b353dcb61c81b488f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 14 Sep 2017 18:24:14 +0200 Subject: [PATCH] Print the "Forgot your password? ..." message only if the user has set the recovery email address #1329 --- .../fr/xephi/authme/process/login/AsynchronousLogin.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java index b96efdfa0..4e2f0d2b9 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java @@ -168,7 +168,7 @@ public class AsynchronousLogin implements AsynchronousProcess { if (passwordSecurity.comparePassword(password, auth.getPassword(), player.getName())) { return true; } else { - handleWrongPassword(player, ip); + handleWrongPassword(player, auth, ip); return false; } } @@ -177,9 +177,10 @@ public class AsynchronousLogin implements AsynchronousProcess { * Handles a login with wrong password. * * @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 */ - private void handleWrongPassword(Player player, String ip) { + private void handleWrongPassword(Player player, PlayerAuth auth, String ip) { ConsoleLogger.fine(player.getName() + " used the wrong password"); bukkitService.createAndCallEvent(isAsync -> new FailedLoginEvent(player, isAsync)); @@ -196,7 +197,7 @@ public class AsynchronousLogin implements AsynchronousProcess { limboService.muteMessageTask(player); service.send(player, MessageKey.USAGE_CAPTCHA, 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); } }