Devices, Extensions, Gateways, Users: Bypass browser password manager prompt when saving.

This commit is contained in:
reliberate
2016-02-25 18:19:51 -07:00
parent 7d6ef13fed
commit 9b9d8b4e3b
5 changed files with 115 additions and 46 deletions

View File

@@ -496,24 +496,26 @@ require_once "resources/require.php";
if (duplicate_mac == false) {
var username = document.getElementById('device_username').value;
var domain_uuid = document.getElementById('domain_uuid').value;
$("#duplicate_username_response").load("device_edit.php?check=duplicate&username="+username+"&domain_uuid="+domain_uuid+"&device_uuid=<?php echo $device_uuid;?>", function() {
var duplicate_username = false;
if (username != '') {
$("#duplicate_username_response").load("device_edit.php?check=duplicate&username="+username+"&domain_uuid="+domain_uuid+"&device_uuid=<?php echo $device_uuid;?>", function() {
var duplicate_username = false;
if ($("#duplicate_username_response").html() != '') {
$('#device_username').addClass('formfld_highlight_bad');
display_message($("#duplicate_username_response").html(), 'negative'<?php if (if_group("superadmin")) { echo ', 3000'; } ?>);
duplicate_username = true;
}
else {
$("#duplicate_username_response").html('');
$('#device_username').removeClass('formfld_highlight_bad');
duplicate_username = false;
}
if (duplicate_username == false) {
document.getElementById('frm').submit();
}
});
if ($("#duplicate_username_response").html() != '') {
$('#device_username').addClass('formfld_highlight_bad');
display_message($("#duplicate_username_response").html(), 'negative'<?php if (if_group("superadmin")) { echo ', 3000'; } ?>);
duplicate_username = true;
}
else {
$("#duplicate_username_response").html('');
$('#device_username').removeClass('formfld_highlight_bad');
duplicate_username = false;
submit_form_2();
}
});
}
else {
submit_form_2();
}
}
});
}
@@ -584,7 +586,7 @@ require_once "resources/require.php";
}
//show the content
echo "<form method='post' name='frm' id='frm' action='' onsubmit='check_duplicates(); return false;'>\n";
echo "<form name='frm' id='frm' method='post' action=''>\n";
//echo "<input style='display:none;' type='password' name='autocomplete'>";
echo "<input type='hidden' name='file_action' id='file_action' value=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@@ -609,7 +611,7 @@ require_once "resources/require.php";
echo " <select class='formfld' style='display: none; width: auto;' name='target_file' id='target_file' onchange='download(this.value)'>\n";
echo " <option value=''>".$text['label-download']."</option>\n";
foreach ($files as $file) {
//format the mac address and
//format the mac address and
$format = new provision();
$mac = $format->format_mac($device_mac_address, $device_vendor);
//render the file name
@@ -623,7 +625,7 @@ require_once "resources/require.php";
if (permission_exists('device_add') && $action != "add") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".$device_uuid."&mac=' + new_mac; }\" value='".$text['button-copy']."'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo "</td>\n";
echo "</tr>\n";
@@ -1222,7 +1224,7 @@ require_once "resources/require.php";
echo "</td>\n";
//echo " <td align='left'>\n";
//echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
//echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
//echo " </td>\n";
echo " <td nowrap='nowrap'>\n";
if (strlen($row['device_key_uuid']) > 0) {
@@ -1327,7 +1329,7 @@ require_once "resources/require.php";
}
/*
echo " <td align='left'>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
*/
echo " </table>\n";
echo " </td>\n";
@@ -1341,7 +1343,7 @@ require_once "resources/require.php";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_username' id='device_username' autocomplete=\"off\" maxlength='255' placeholder=\"".$text['label-device_username']."\" value=\"$device_username\">\n";
echo " <input class='formfld' type='text' name='device_password' id='device_password' autocomplete=\"off\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
echo " <input class='formfld' type='password' name='device_password' id='device_password' autocomplete=\"off\" onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' placeholder=\"".$text['label-device_password']."\" value=\"$device_password\">\n";
echo " <div style='display: none;' id='duplicate_username_response'></div>\n";
echo "<br />\n";
echo $text['description-device']."\n";
@@ -1365,7 +1367,7 @@ require_once "resources/require.php";
echo " <table>\n";
echo " <tr>\n";
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">&nbsp;</td>";
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; submit_form(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
echo " </tr>\n";
echo " </table>\n";
unset($label);
@@ -1492,13 +1494,29 @@ require_once "resources/require.php";
echo " <input type='hidden' name='device_uuid' value='$device_uuid'>\n";
}
echo " <br>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
echo "<script>\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// convert password fields to
echo " function submit_form() {\n";
echo " check_duplicates();\n";
echo " }\n";
echo " function submit_form_2() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -993,8 +993,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "}\n";
echo "</script>";
echo "<form method='post' name='frm' action='' autocomplete='off'>\n";
echo "<input style='display:none;' type='password' name='autocomplete'>";
echo "<form method='post' name='frm' id='frm' action=''>\n";
echo "<table width='100%' border='0' cellpdding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
@@ -1011,7 +1010,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='button' class='btn' alt='".$text['button-copy']."' onclick=\"copy_extension();\" value='".$text['button-copy']."'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo " <br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
@@ -1115,7 +1114,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n";
echo " <td class='vtable'><a href='/core/users/usersupdate.php?id=".$field['user_uuid']."'>".$field['username']."</a></td>\n";
echo " <td>\n";
echo " <a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('delete_type').value = 'user'; document.getElementById('delete_uuid').value = '".$field['user_uuid']."'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a>\n";
echo " <a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('delete_type').value = 'user'; document.getElementById('delete_uuid').value = '".$field['user_uuid']."'; submit_form(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a>\n";
//echo " <a href='extension_edit.php?id=".$extension_uuid."&domain_uuid=".$_SESSION['domain_uuid']."&user_uuid=".$field['user_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo " </tr>\n";
@@ -1130,8 +1129,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
}
echo " </select>";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
echo " <input type='button' class='btn' value=\"".$text['button-add']."\" onclick='submit_form();'>\n";
echo " <br>\n";
echo " ".$text['description-user_list']."\n";
echo " <br />\n";
@@ -1190,7 +1189,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <td class='vtable'>".$row['device_template']."&nbsp;</td>\n";
//echo " <td class='vtable'>".$row['device_description']."&nbsp;</td>\n";
echo " <td>\n";
echo " <a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('delete_type').value = 'device_line'; document.getElementById('delete_uuid').value = '".$row['device_line_uuid']."'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a>\n";
echo " <a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('delete_type').value = 'device_line'; document.getElementById('delete_uuid').value = '".$row['device_line_uuid']."'; submit_form(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a>\n";
echo " </td>\n";
echo " </tr>\n";
}
@@ -1301,7 +1300,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</select>\n";
echo " </td>\n";
echo " <td>\n";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
echo " <input type='button' class='btn' value=\"".$text['button-add']."\" onclick='submit_form();'>\n";
echo " </td>\n";
echo " </table>\n";
echo " <br />\n";
@@ -1683,7 +1682,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-call_group']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if (is_array($_SESSION['call group']['name'])) {
if (is_array($_SESSION['call group']['name'])) {
echo " <select class='formfld' name='call_group'>\n";
echo " <option value=''></option>\n";
foreach ($_SESSION['call group']['name'] as $name) {
@@ -2025,13 +2024,26 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <input type='hidden' name='delete_uuid' id='delete_uuid' value=''>";
}
echo " <br>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
echo "<script>\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// convert password fields to
echo " function submit_form() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";
//include the footer
require_once "resources/footer.php";

View File

@@ -428,7 +428,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "}\n";
echo "</script>";
echo "<form method='post' name='frm' action=''>\n";
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
@@ -443,7 +443,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='gateway_copy.php?id=".$gateway_uuid."';}\" value='".$text['button-copy']."'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo " </td>\n";
echo " </tr>";
echo " <tr>";
@@ -938,13 +938,26 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <input type='hidden' name='gateway_uuid' value='$gateway_uuid'>\n";
}
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
echo "<script>\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// convert password fields to
echo " function submit_form() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";
//include the footer
require_once "resources/footer.php";

View File

@@ -279,7 +279,7 @@ if (count($_POST) > 0 && check_str($_POST["persistform"]) != "1") {
echo "</script>";
$tablewidth ='width="100%"';
echo "<form method='post' action=''>";
echo "<form name='frm' id='frm' method='post' action=''>";
echo "<table border='0' $tablewidth cellpadding='0' cellspacing='0'>";
echo " <tr>\n";
@@ -350,12 +350,25 @@ if (count($_POST) > 0 && check_str($_POST["persistform"]) != "1") {
echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <br><input type='submit' name='submit' class='btn' value='".$text['button-create_account']."'>";
echo " <br><input type='button' class='btn' value='".$text['button-create_account']."' onclick='submit_form();'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<script>\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// convert password fields to
echo " function submit_form() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -368,7 +368,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
//redirect the browser
$_SESSION["message"] = $text['message-update'];
if ($_REQUEST['submit'] == $text['button-add']) {
if ($_REQUEST['action'] == $text['button-add']) {
header("Location: usersupdate.php?id=".$user_uuid);
}
else {
@@ -435,13 +435,13 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
echo " }";
echo "</script>";
echo "<form method='post' action=''>";
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<input type='hidden' name='action' id='action' value=''>\n";
echo "<table $table_width cellpadding='0' cellspacing='0' border='0'>";
echo "<td align='left' width='90%' nowrap><b>".$text['header-user_edit']."</b></td>\n";
echo "<td align='right' nowrap>\n";
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick=\"document.getElementById('action').value = '".$text['button-save']."'; submit_form();\">";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
@@ -570,7 +570,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
}
}
echo "</select>";
echo "<input type='submit' name='submit' class='btn' value=\"".$text['button-add']."\">\n";
echo "<input type='button' class='btn' value=\"".$text['button-add']."\" onclick=\"document.getElementById('action').value = '".$text['button-add']."'; submit_form();\">\n";
}
unset($sql, $prep_statement, $result);
@@ -745,13 +745,26 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
echo " <input type='hidden' name='id' value=\"$user_uuid\">";
echo " <input type='hidden' name='username_old' value=\"$username\">";
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick=\"document.getElementById('action').value = '".$text['button-save']."'; submit_form();\">";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
echo "<script>\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// convert password fields to
echo " function submit_form() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";
//include the footer
require_once "resources/footer.php";