mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-06 20:28:06 +02:00
#527 Persist email after changing it
This commit is contained in:
parent
964abdc0c5
commit
6f694cf818
@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.process.email;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
@ -46,12 +47,15 @@ public class AsyncAddEmail {
|
||||
messages.send(player, MessageKey.INVALID_EMAIL);
|
||||
} else if (dataSource.isEmailStored(email)) {
|
||||
messages.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
} else if (dataSource.updateEmail(auth)) {
|
||||
auth.setEmail(email);
|
||||
playerCache.updatePlayer(auth);
|
||||
messages.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
} else {
|
||||
messages.send(player, MessageKey.ERROR);
|
||||
auth.setEmail(email);
|
||||
if (dataSource.updateEmail(auth)) {
|
||||
playerCache.updatePlayer(auth);
|
||||
messages.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
} else {
|
||||
ConsoleLogger.showError("Could not save email for player '" + player + "'");
|
||||
messages.send(player, MessageKey.ERROR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendUnloggedMessage(dataSource);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.process.email;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
@ -35,6 +36,7 @@ public class AsyncAddEmailTest {
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
WrapperMock.createInstance();
|
||||
ConsoleLoggerTestInitializer.setupLogger();
|
||||
}
|
||||
|
||||
// Clean up the fields to ensure that no test uses elements of another test
|
||||
|
Loading…
Reference in New Issue
Block a user