mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 10:56:24 +00:00
Check for token in chat input and forbid
This commit is contained in:
parent
f4cd676d2b
commit
d73b05f76c
@ -160,7 +160,14 @@ class Chat extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onButtonClicked = (e) => {
|
onButtonClicked = (e) => {
|
||||||
if(this.state.value.substring(0,1)=='#'){
|
// If input string contains token. Do not set message
|
||||||
|
if(this.state.value.indexOf(this.state.token) !== -1){
|
||||||
|
alert(`Aye! You just sent your own robot token to your peer in chat, that's a catastrophic idea! So bad your message was blocked.`)
|
||||||
|
this.setState({value: ""});
|
||||||
|
}
|
||||||
|
|
||||||
|
// If input string contains '#' send unencrypted and unlogged message
|
||||||
|
else if(this.state.value.substring(0,1)=='#'){
|
||||||
this.rws.send(JSON.stringify({
|
this.rws.send(JSON.stringify({
|
||||||
type: "message",
|
type: "message",
|
||||||
message: this.state.value,
|
message: this.state.value,
|
||||||
@ -169,6 +176,7 @@ class Chat extends Component {
|
|||||||
this.setState({value: ""});
|
this.setState({value: ""});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Else if message is not empty send message
|
||||||
else if(this.state.value!=''){
|
else if(this.state.value!=''){
|
||||||
this.setState({value: "", waitingEcho: true, lastSent:this.state.value})
|
this.setState({value: "", waitingEcho: true, lastSent:this.state.value})
|
||||||
encryptMessage(this.state.value, this.state.own_pub_key, this.state.peer_pub_key, this.state.own_enc_priv_key, this.state.token)
|
encryptMessage(this.state.value, this.state.own_pub_key, this.state.peer_pub_key, this.state.own_enc_priv_key, this.state.token)
|
||||||
|
Loading…
Reference in New Issue
Block a user