mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 12:45:57 +01:00
#601 Increase captcha count on login start
- Increase login count at start of the login process (as done previously) and not only when login has failed AND player is still online - Add missing javadoc to CaptchaManager
This commit is contained in:
parent
12703d1613
commit
40ce01f65e
@ -110,6 +110,11 @@ public class CaptchaManager implements SettingsDependent {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the login count of the given player to 0.
|
||||
*
|
||||
* @param name the player's name
|
||||
*/
|
||||
public void resetCounts(String name) {
|
||||
if (isEnabled) {
|
||||
captchaCodes.remove(name.toLowerCase());
|
||||
|
@ -73,9 +73,14 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
|
||||
|
||||
private boolean needsCaptcha(Player player) {
|
||||
if (captchaManager.isCaptchaRequired(player.getName())) {
|
||||
service.send(player, MessageKey.USAGE_CAPTCHA, captchaManager.getCaptchaCodeOrGenerateNew(player.getName()));
|
||||
final String playerName = player.getName();
|
||||
if (captchaManager.isCaptchaRequired(playerName)) {
|
||||
service.send(player, MessageKey.USAGE_CAPTCHA, captchaManager.getCaptchaCodeOrGenerateNew(playerName));
|
||||
return true;
|
||||
} else {
|
||||
// Increase the count here before knowing the result of the login.
|
||||
// If login is successful, we clear the count for the player
|
||||
captchaManager.increaseCount(playerName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -199,7 +204,6 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||
ConsoleLogger.info(player.getName() + " used the wrong password");
|
||||
}
|
||||
captchaManager.increaseCount(name);
|
||||
if (service.getProperty(RestrictionSettings.KICK_ON_WRONG_PASSWORD)) {
|
||||
bukkitService.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user