Trigger key on first

This commit is contained in:
Dan Seripap 2016-01-08 19:17:41 -05:00
parent 171b844e98
commit ad7a84aecb
3 changed files with 9 additions and 1 deletions

View File

@ -285,6 +285,10 @@ $(function() {
removeChatTyping(data); removeChatTyping(data);
}); });
socket.on('first', function() {
$('.modal').modal('show');
});
setUsername(); setUsername();
$('span.key-btn').click(function() { $('span.key-btn').click(function() {

View File

@ -24,6 +24,10 @@ class Room {
socket.on('add user', (username) => { socket.on('add user', (username) => {
if (addedUser) return; if (addedUser) return;
if (this.numUsers === 0) {
socket.emit('first');
}
// we store the username in the socket session for this client // we store the username in the socket session for this client
socket.username = username; socket.username = username;
++this.numUsers; ++this.numUsers;

View File

@ -30,7 +30,7 @@
<h4 class="modal-title">Key</h4> <h4 class="modal-title">Key</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Enter your key below</p> <p>This is your chat encryption key. Anyone who is in this chat room must use the same key to decrypt chat messages. This key is <strong>NOT</strong> stored nor transmitted to the server. If the key does not match, other clients will see encrypted messages. You may change the key as many times as you want.</p>
<input id="key" placeholder="Enter key here"> <input id="key" placeholder="Enter key here">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">