#437 Add/change email should check if email is already used

- Untested/incomplete implementation
This commit is contained in:
ljacqu
2016-01-17 20:41:19 +01:00
parent ace95f750a
commit b0ba893827
11 changed files with 105 additions and 177 deletions
@@ -36,10 +36,13 @@ public class AsyncAddEmail {
PlayerAuth auth = playerCache.getAuth(playerName);
String currentEmail = auth.getEmail();
if (currentEmail != null) {
if (currentEmail != null && !"your@mail.com".equals(currentEmail)) {
System.out.println("Email is currentEmail " + currentEmail); // FIXME remove
messages.send(player, MessageKey.USAGE_CHANGE_EMAIL);
} else if (isEmailInvalid(email)) {
messages.send(player, MessageKey.INVALID_EMAIL);
} else if (dataSource.isEmailStored(email)) {
messages.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
} else {
auth.setEmail(email);
playerCache.updatePlayer(auth);