Fix gen key bug

This commit is contained in:
Alan Friedman 2016-01-11 13:35:36 -05:00
parent 45325e80cf
commit 5957e256c7

View File

@ -264,6 +264,7 @@ $(function() {
$genKey.click(function () { $genKey.click(function () {
var key = (Math.random() * Math.random()).toString(36).substring(7); var key = (Math.random() * Math.random()).toString(36).substring(7);
$key.val(key); $key.val(key);
keyInputChanged(key);
}); });
$removeKey.click(function() { $removeKey.click(function() {
@ -383,10 +384,7 @@ $(function() {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
$('.key').on('input', function() { function keyInputChanged(val) {
var val = $(this).val();
$('.key').val(val);
if (!val.trim().length) { if (!val.trim().length) {
encryptionEnabled = false; encryptionEnabled = false;
$('.modal-footer button.encryption-inactive').show(); $('.modal-footer button.encryption-inactive').show();
@ -399,7 +397,13 @@ $(function() {
$('.modal-footer button.encryption-inactive').hide(); $('.modal-footer button.encryption-inactive').hide();
$('.chat .warning-sign').hide(); $('.chat .warning-sign').hide();
$('.inputMessage').removeClass('encryption-disabled'); $('.inputMessage').removeClass('encryption-disabled');
} }
}
$('.key').on('input propertychange paste change', function() {
var val = $(this).val();
$('.key').val(val);
keyInputChanged(val);
}); });
$('.modal-footer button.encryption-inactive').click(function() { $('.modal-footer button.encryption-inactive').click(function() {