mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-22 23:51:33 +01:00
Add logging for when a player changes their password or has a new one generated
This commit is contained in:
parent
4053a0e328
commit
ce40b3798b
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.command.executable.email;
|
package fr.xephi.authme.command.executable.email;
|
||||||
|
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.command.PlayerCommand;
|
import fr.xephi.authme.command.PlayerCommand;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
@ -44,6 +45,7 @@ public class SetPasswordCommand extends PlayerCommand {
|
|||||||
if (!result.hasError()) {
|
if (!result.hasError()) {
|
||||||
HashedPassword hashedPassword = passwordSecurity.computeHash(password, name);
|
HashedPassword hashedPassword = passwordSecurity.computeHash(password, name);
|
||||||
dataSource.updatePassword(name, hashedPassword);
|
dataSource.updatePassword(name, hashedPassword);
|
||||||
|
ConsoleLogger.info("Player '" + name + "' has changed their password from recovery");
|
||||||
commonService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
|
commonService.send(player, MessageKey.PASSWORD_CHANGED_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
commonService.send(player, result.getMessageKey(), result.getArgs());
|
commonService.send(player, result.getMessageKey(), result.getArgs());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.service;
|
package fr.xephi.authme.service;
|
||||||
|
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
@ -96,6 +97,8 @@ public class PasswordRecoveryService implements Reloadable {
|
|||||||
String thePass = RandomStringUtils.generate(commonService.getProperty(RECOVERY_PASSWORD_LENGTH));
|
String thePass = RandomStringUtils.generate(commonService.getProperty(RECOVERY_PASSWORD_LENGTH));
|
||||||
HashedPassword hashNew = passwordSecurity.computeHash(thePass, name);
|
HashedPassword hashNew = passwordSecurity.computeHash(thePass, name);
|
||||||
|
|
||||||
|
ConsoleLogger.info("Generating new password for '" + name + "'");
|
||||||
|
|
||||||
dataSource.updatePassword(name, hashNew);
|
dataSource.updatePassword(name, hashNew);
|
||||||
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass);
|
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass);
|
||||||
if (couldSendMail) {
|
if (couldSendMail) {
|
||||||
|
Loading…
Reference in New Issue
Block a user