The actual cleanup

Removed commented old code
This commit is contained in:
samo_lego 2019-11-19 22:22:20 +01:00
parent 5ef361da64
commit 47fd0cb0fb
5 changed files with 1 additions and 105 deletions

View File

@ -95,25 +95,8 @@ public class AuthCommand {
sender.sendMessage(userdataUpdated);
else
LOGGER.info(userdataUpdated);
/*// Create instance
Argon2 argon2 = Argon2Factory.create();
char[] password = pass.toCharArray();
try {
// Hashed password from DB
String hash = argon2.hash(10, 65536, 1, pass.toCharArray());
// Writing into DB
SimpleAuth.db.update(uuid, username, hash);
if(sender != null)
sender.sendMessage(userdataUpdated);
else
LOGGER.info(userdataUpdated);
} finally {
// Wipe confidential data
argon2.wipeArray(password);
}*/
// TODO -> Kick player whose name was changed?
return 1; // Success
return 1;
}
private static int removeAccount(ServerCommandSource source, String uuid, String username) {
Entity sender = source.getEntity();

View File

@ -61,25 +61,5 @@ public class ChangepwCommand {
}
player.sendMessage(wrongPassword);
return 0;
// Create instance
//Argon2 argon2 = Argon2Factory.create();
/*try {
// Hashed password from DB
String hashedOld = SimpleAuth.db.getPassword(player.getUuidAsString());
// Verify password
if (argon2.verify(hashedOld, password)) {
String hash = argon2.hash(10, 65536, 1, newPass.toCharArray());
// Writing into DB
SimpleAuth.db.update(player.getUuidAsString(), null, hash);
player.sendMessage(passwordUpdated);
}
else
player.sendMessage(wrongPassword);
} finally {
// Wipe confidential data
argon2.wipeArray(password);
}*/
}
}

View File

@ -51,26 +51,5 @@ public class LoginCommand {
}
player.sendMessage(wrongPassword);
return 0;
/*// Create instance
Argon2 argon2 = Argon2Factory.create();
// Read password from user
char[] password = pass.toCharArray();
try {
// Hashed password from DB
String hashed = SimpleAuth.db.getPassword(player.getUuidAsString());
// Verify password
if (argon2.verify(hashed, password)) {
SimpleAuth.authenticatedUsers.add(player);
player.sendMessage(text);
} else {
player.sendMessage(wrongPassword);
}
} finally {
// Wipe confidential data
argon2.wipeArray(password);
}
return 1;*/
}
}

View File

@ -55,31 +55,6 @@ public class RegisterCommand {
}
player.sendMessage(alreadyRegistered);
return 0;
/*// Create instance
Argon2 argon2 = Argon2Factory.create();
// Read password from user
char[] password = pass1.toCharArray();
try {
// Hash password
String hash = argon2.hash(10, 65536, 1, password);
// Writing into database
if(SimpleAuth.db.registerUser(Objects.requireNonNull(source.getEntity()).getUuidAsString(), source.getName(), hash)) {
SimpleAuth.authenticatedUsers.add(player);
// Letting the player know it was successful
player.sendMessage(
new LiteralText(source.getName() + ", you have registered successfully!")
);
}
else
player.sendMessage(alreadyRegistered);
} catch (Error e) {
player.sendMessage(alreadyRegistered);
} finally {
// Wipe confidential data
argon2.wipeArray(password);
}*/
}
player.sendMessage(
new LiteralText(source.getName() + ", passwords must match!")

View File

@ -41,27 +41,6 @@ public class UnregisterCommand { // TODO
// Getting the player who send the command
ServerPlayerEntity player = source.getPlayer();
// Create instance
Argon2 argon2 = Argon2Factory.create();
// Read password from user
char[] password = pass.toCharArray();
try {
// Hashed password from DB
String hashedOld = SimpleAuth.db.getPassword(player.getUuidAsString());
// Verify password
if (argon2.verify(hashedOld, password)) {
// Writing into DB
SimpleAuth.db.delete(player.getUuidAsString(), null);
player.sendMessage(accountDeleted);
}
else
player.sendMessage(wrongPassword);
} finally {
// Wipe confidential data
argon2.wipeArray(password);
}
return 1;
}
}