cvmts: fix rename oddities
This commit is contained in:
@@ -477,7 +477,7 @@ export default class CollabVMServer implements IProtocolMessageHandler {
|
||||
this.renameUser(user, undefined);
|
||||
return;
|
||||
}
|
||||
this.renameUser(user, newName!);
|
||||
this.renameUser(user, newName);
|
||||
}
|
||||
|
||||
onChat(user: User, message: string): void {
|
||||
@@ -719,6 +719,8 @@ export default class CollabVMServer implements IProtocolMessageHandler {
|
||||
let oldname: any;
|
||||
if (hadName) oldname = client.username;
|
||||
|
||||
let status = ProtocolRenameStatus.Ok;
|
||||
|
||||
if (!newName) {
|
||||
client.assignGuestName(this.getUsernameList());
|
||||
} else {
|
||||
@@ -728,8 +730,6 @@ export default class CollabVMServer implements IProtocolMessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
let status = ProtocolRenameStatus.Ok;
|
||||
|
||||
if (this.getUsernameList().indexOf(newName) !== -1) {
|
||||
client.assignGuestName(this.getUsernameList());
|
||||
if (client.connectedToNode) {
|
||||
@@ -742,9 +742,9 @@ export default class CollabVMServer implements IProtocolMessageHandler {
|
||||
client.assignGuestName(this.getUsernameList());
|
||||
status = ProtocolRenameStatus.UsernameNotAllowed;
|
||||
} else client.username = newName;
|
||||
}
|
||||
|
||||
client.protocol.sendSelfRename(status, client.username!, client.rank);
|
||||
}
|
||||
|
||||
if (hadName) {
|
||||
this.logger.info(`Rename ${client.IP.address} from ${oldname} to ${client.username}`);
|
||||
|
||||
@@ -292,11 +292,11 @@ export class GuacamoleProtocol extends ProtocolBase implements IProtocol {
|
||||
}
|
||||
|
||||
sendSelfRename(status: ProtocolRenameStatus, newUsername: string, rank: Rank): void {
|
||||
this.user?.sendMsg(cvm.guacEncode('rename', '0', status.toString(), newUsername, rank.toString()));
|
||||
this.user?.sendMsg(cvm.guacEncode('rename', '0', status.toString(), newUsername));
|
||||
}
|
||||
|
||||
sendRename(oldUsername: string, newUsername: string, rank: Rank): void {
|
||||
this.user?.sendMsg(cvm.guacEncode('rename', '1', oldUsername, newUsername, rank.toString()));
|
||||
this.user?.sendMsg(cvm.guacEncode('rename', '1', oldUsername, newUsername));
|
||||
}
|
||||
|
||||
sendListResponse(list: ListEntry[]): void {
|
||||
|
||||
Reference in New Issue
Block a user