proper fix for focus and some styling of the form and allows for pressing enter on form so generally a better fix

pull/1220/head
John McLear 2012-11-26 20:52:10 +00:00
parent de5a90b9c7
commit fddca354b3
1 changed files with 12 additions and 4 deletions

View File

@ -305,14 +305,22 @@ function handshake()
else if(obj.accessStatus == "needPassword")
{
$("#editorloadingbox").html("<b>You need a password to access this pad</b><br>" +
"<input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
"<form class='passForm'><input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword();") + "\">ok</button></div>");
$("#passwordinput").focus();
$(".passForm").submit(function(){
$('.passForm button').click();
});
}
else if(obj.accessStatus == "wrongPassword")
{
$("#editorloadingbox").html("<b>Your password was wrong</b><br>" +
"<input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
"<form class='passForm'><input id='passwordinput' type='password' name='password'>"+
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword();") + "\">ok</button></div>");
$("#passwordinput").focus();
$(".passForm").submit(function(){
$('.passForm button').click();
});
}
}