Improved CSRF handling
This commit is contained in:
parent
2d5afc23d7
commit
1f00bacb6f
4 changed files with 74 additions and 8 deletions
|
|
@ -48,8 +48,16 @@ class channel{
|
|||
document.title = `${this.channelName} - Connected`
|
||||
});
|
||||
|
||||
this.socket.on("kick", (data) => {
|
||||
new canopyUXUtils.popup(`You have been ${data.type} from the channel for the following reason:<br>${data.reason}`);
|
||||
this.socket.on("kick", async (data) => {
|
||||
if(data.reason == "Invalid CSRF Token!"){
|
||||
//Reload the CSRF token
|
||||
await utils.ajax.reloadCSRFToken();
|
||||
|
||||
//Retry the connection
|
||||
this.connect();
|
||||
}else{
|
||||
new canopyUXUtils.popup(`You have been ${data.type} from the channel for the following reason:<br>${data.reason}`);
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on("clientMetadata", this.handleClientInfo.bind(this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue