#437 Add email should not allow to change email
- Create separate test for adding email - Check that no email is yet registered for add email
This commit is contained in:
@@ -2,6 +2,9 @@ package fr.xephi.authme.command.executable.email;
|
||||
|
||||
import fr.xephi.authme.command.CommandService;
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
@@ -10,9 +13,15 @@ public class AddEmailCommand extends PlayerCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(Player player, List<String> arguments, CommandService commandService) {
|
||||
String playerMail = arguments.get(0);
|
||||
String playerMailVerify = arguments.get(1);
|
||||
String email = arguments.get(0);
|
||||
String emailConfirmation = arguments.get(1);
|
||||
|
||||
commandService.getManagement().performAddEmail(player, playerMail, playerMailVerify);
|
||||
if (StringUtils.isEmpty(email) || "your@email.com".equals(email) || !Settings.isEmailCorrect(email)) {
|
||||
commandService.send(player, MessageKey.INVALID_EMAIL);
|
||||
} else if (email.equals(emailConfirmation)) {
|
||||
commandService.getManagement().performAddEmail(player, email);
|
||||
} else {
|
||||
commandService.send(player, MessageKey.CONFIRM_EMAIL_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user