From ef7b3967b22a479d430f3fe3fe3974997e04ed1b Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 25 Jul 2015 15:44:23 +0200 Subject: [PATCH] Better auth dialog behavior --- public/js/vroom.js | 13 +++++++------ templates/default/auth_modal.html.ep | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index a045560..dd5ccfd 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -2022,12 +2022,12 @@ function initVroom(room) { }); // Handle auth to become room owner - $('#authPass').on('input', function() { - if ($('#authPass').val() === ''){ - $('#authPassButton').addClass('disabled'); + $('#ownerAuthPass').on('input', function() { + if ($('#ownerAuthPass').val() === ''){ + $('#ownerAuthButton').attr('disabled', 'disabled'); } else{ - $('#authPassButton').removeClass('disabled'); + $('#ownerAuthButton').removeAttr('disabled'); } }); $('#ownerAuthForm').submit(function(event) { @@ -2040,15 +2040,16 @@ function initVroom(room) { room: roomName }, function(data){ - $('#authPass').val(''); - $('#ownerAuthModal').modal('hide'); + $('#ownerAuthPass').val(''); if (data.role === 'owner'){ getPeerRole(peers.local.id); $('#joinPassFields,#ownerPassFields').hide(); + $('#ownerAuthModal').modal('hide'); $.notify(data.msg, 'success'); } else{ $.notify(localize('WRONG_PASSWORD'), 'error'); + $('#ownerAuthButton').attr('disabled', 'disabled'); } } ); diff --git a/templates/default/auth_modal.html.ep b/templates/default/auth_modal.html.ep index 8140736..4ddda33 100644 --- a/templates/default/auth_modal.html.ep +++ b/templates/default/auth_modal.html.ep @@ -30,7 +30,9 @@