mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-06 16:07:45 +01: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;
|
package fr.xephi.authme.process.email;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -46,12 +47,15 @@ public class AsyncAddEmail {
|
|||||||
messages.send(player, MessageKey.INVALID_EMAIL);
|
messages.send(player, MessageKey.INVALID_EMAIL);
|
||||||
} else if (dataSource.isEmailStored(email)) {
|
} else if (dataSource.isEmailStored(email)) {
|
||||||
messages.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
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 {
|
} 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 {
|
} else {
|
||||||
sendUnloggedMessage(dataSource);
|
sendUnloggedMessage(dataSource);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package fr.xephi.authme.process.email;
|
package fr.xephi.authme.process.email;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -35,6 +36,7 @@ public class AsyncAddEmailTest {
|
|||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
WrapperMock.createInstance();
|
WrapperMock.createInstance();
|
||||||
|
ConsoleLoggerTestInitializer.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up the fields to ensure that no test uses elements of another test
|
// Clean up the fields to ensure that no test uses elements of another test
|
||||||
|
Loading…
Reference in New Issue
Block a user