Use form instead of simple divs for paswords

So hitting enter also submit it
master
Daniel Berteaud 11 years ago
parent 697b143cef
commit 4fb717b6be
  1. 10
      public/js/vroom.js
  2. 12
      templates/default/join.html.ep

@ -681,7 +681,8 @@ function initVroom(room) {
}); });
// Join password protection // Join password protection
$('#setJoinPassButton').click(function(event) { $('#joinPassForm').submit(function(event) {
event.preventDefault();
var pass = $('#joinPass').val(); var pass = $('#joinPass').val();
$('#joinPass').val(''); $('#joinPass').val('');
$('#setJoinPassButton').addClass('disabled'); $('#setJoinPassButton').addClass('disabled');
@ -734,7 +735,7 @@ function initVroom(room) {
}); });
}); });
// Set owner password
$('#ownerPass').on('input', function() { $('#ownerPass').on('input', function() {
if ($('#ownerPass').val() == ''){ if ($('#ownerPass').val() == ''){
$('#setOwnerPassButton').addClass('disabled'); $('#setOwnerPassButton').addClass('disabled');
@ -743,9 +744,8 @@ function initVroom(room) {
$('#setOwnerPassButton').removeClass('disabled'); $('#setOwnerPassButton').removeClass('disabled');
} }
}); });
$('#ownerPassForm').submit(function(event) {
// Set owner password event.preventDefault();
$('#setOwnerPassButton').click(function(event) {
var pass = $('#ownerPass').val(); var pass = $('#ownerPass').val();
$('#ownerPass').val(''); $('#ownerPass').val('');
$('#setOwnerPassButton').addClass('disabled'); $('#setOwnerPassButton').addClass('disabled');

@ -87,14 +87,14 @@
</button> </button>
<ul class="dropdown-menu" role="menu" aria-labelledby="confMenuButton" id="confMenu"> <ul class="dropdown-menu" role="menu" aria-labelledby="confMenuButton" id="confMenu">
<li> <li>
<div class="navbar-form"> <form class="navbar-form" id="joinPassForm">
<center> <center>
<p><%=l 'YOU_CAN_PASSWORD_PROTECT_JOIN' %></p> <p><%=l 'YOU_CAN_PASSWORD_PROTECT_JOIN' %></p>
</center> </center>
<div class="input-group"> <div class="input-group">
<input type="password" id="joinPass" class="form-control help" placeholder="<%=l 'PASSWORD' %>" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PASSWORD_PROTECT' %>"/> <input type="password" id="joinPass" class="form-control help" placeholder="<%=l 'PASSWORD' %>" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PASSWORD_PROTECT' %>"/>
<span class="input-group-btn"> <span class="input-group-btn">
<button id="setJoinPassButton" type="button" class="btn btn-default help disabled" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PASSWORD_PROTECT' %>"> <button id="setJoinPassButton" type="submit" class="btn btn-default help disabled" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PASSWORD_PROTECT' %>">
<span class="glyphicon glyphicon-ok" <span class="glyphicon glyphicon-ok"
</span> </span>
</button> </button>
@ -104,19 +104,19 @@
</button> </button>
</span> </span>
</div> </div>
</div> </form>
</li> </li>
<li class="divider"> <li class="divider">
</li> </li>
<li> <li>
<div class="navbar-form"> <form class="navbar-form" id="ownerPassForm">
<center> <center>
<p><%=l 'OWNER_PASSWORD_MAKES_PERSISTENT' %></p> <p><%=l 'OWNER_PASSWORD_MAKES_PERSISTENT' %></p>
</center> </center>
<div class="input-group"> <div class="input-group">
<input type="password" id="ownerPass" class="form-control help" placeholder="<%=l 'PASSWORD' %>" data-toggle="tooltip" data-placement="bottom" title="<%=l 'OWNER_PASSWORD' %>"/> <input type="password" id="ownerPass" class="form-control help" placeholder="<%=l 'PASSWORD' %>" data-toggle="tooltip" data-placement="bottom" title="<%=l 'OWNER_PASSWORD' %>"/>
<span class="input-group-btn"> <span class="input-group-btn">
<button id="setOwnerPassButton" type="button" class="btn btn-default help disabled" data-toggle="tooltip" data-placement="bottom" title="<%=l 'OWNER_PASSWORD' %>"> <button id="setOwnerPassButton" type="submit" class="btn btn-default help disabled" data-toggle="tooltip" data-placement="bottom" title="<%=l 'OWNER_PASSWORD' %>">
<span class="glyphicon glyphicon-ok" <span class="glyphicon glyphicon-ok"
</span> </span>
</button> </button>
@ -126,7 +126,7 @@
</button> </button>
</span> </span>
</div> </div>
</div> </form>
</li> </li>
</ul> </ul>
</div> </div>

Loading…
Cancel
Save