Merge pull request 'Made Server Less Error Prone' (#107) from f/secure-server into develop
Reviewed-on: https://git.kske.dev/zdm/envoy/pulls/107 Reviewed-by: kske <kai@kske.dev>
This commit is contained in:
@ -21,7 +21,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
|
@ -586,7 +586,7 @@ public final class ChatScene implements EventListener, Restorable {
|
||||
// IsTyping#millisecondsActive
|
||||
if (client.isOnline() && currentChat.getLastWritingEvent()
|
||||
+ IsTyping.millisecondsActive <= System.currentTimeMillis()) {
|
||||
client.send(new IsTyping(getChatID(), currentChat.getRecipient().getID()));
|
||||
client.send(new IsTyping(currentChat.getRecipient().getID()));
|
||||
currentChat.lastWritingEventWasNow();
|
||||
}
|
||||
|
||||
@ -600,19 +600,6 @@ public final class ChatScene implements EventListener, Restorable {
|
||||
checkPostConditions(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the id that should be used to send things to the server: the id of 'our' {@link User}
|
||||
* if the recipient of that object is another User, else the id of the {@link Group} 'our' user
|
||||
* is sending to.
|
||||
*
|
||||
* @return an id that can be sent to the server
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
private long getChatID() {
|
||||
return currentChat.getRecipient() instanceof User ? client.getSender().getID()
|
||||
: currentChat.getRecipient().getID();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param e the keys that have been pressed
|
||||
* @since Envoy Client v0.1-beta
|
||||
|
@ -137,7 +137,7 @@ public final class UserSettingsPane extends OnlineOnlySettingsPane {
|
||||
|
||||
// Displaying the save button
|
||||
saveButton
|
||||
.setOnAction(e -> save(client.getSender().getID(), currentPasswordField.getText()));
|
||||
.setOnAction(e -> save(currentPasswordField.getText()));
|
||||
saveButton.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
getChildren().add(saveButton);
|
||||
}
|
||||
@ -148,11 +148,11 @@ public final class UserSettingsPane extends OnlineOnlySettingsPane {
|
||||
* @param username the new username
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
private void save(long userID, String oldPassword) {
|
||||
private void save(String oldPassword) {
|
||||
|
||||
// The profile pic was changed
|
||||
if (profilePicChanged) {
|
||||
final var profilePicChangeEvent = new ProfilePicChange(currentImageBytes, userID);
|
||||
final var profilePicChangeEvent = new ProfilePicChange(currentImageBytes);
|
||||
eventBus.dispatch(profilePicChangeEvent);
|
||||
client.send(profilePicChangeEvent);
|
||||
logger.log(Level.INFO, "The user just changed his profile pic.");
|
||||
@ -161,7 +161,7 @@ public final class UserSettingsPane extends OnlineOnlySettingsPane {
|
||||
// The username was changed
|
||||
final var validContactName = Bounds.isValidContactName(newUsername);
|
||||
if (usernameChanged && validContactName) {
|
||||
final var nameChangeEvent = new NameChange(userID, newUsername);
|
||||
final var nameChangeEvent = new NameChange(client.getSender().getID(), newUsername);
|
||||
eventBus.dispatch(nameChangeEvent);
|
||||
client.send(nameChangeEvent);
|
||||
logger.log(Level.INFO, "The user just changed his name to " + newUsername + ".");
|
||||
@ -178,7 +178,7 @@ public final class UserSettingsPane extends OnlineOnlySettingsPane {
|
||||
|
||||
// The password was changed
|
||||
if (validPassword) {
|
||||
client.send(new PasswordChangeRequest(newPassword, oldPassword, userID));
|
||||
client.send(new PasswordChangeRequest(newPassword, oldPassword));
|
||||
logger.log(Level.INFO, "The user just tried to change his password!");
|
||||
} else if (!(validPassword || newPassword.isBlank())) {
|
||||
final var alert = new Alert(AlertType.ERROR);
|
||||
|
Reference in New Issue
Block a user