mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
add password generation functionality
This commit is contained in:
@@ -574,6 +574,30 @@ if (isset($_GET['contact_id'])) {
|
||||
|
||||
<!-- JavaScript to Show/Hide Password Form Group -->
|
||||
<script>
|
||||
|
||||
function generatePassword(type, id) {
|
||||
var url = '/ajax.php?get_readable_pass=true';
|
||||
|
||||
// Make an AJAX request to the server
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var password = xhr.responseText;
|
||||
|
||||
// Set the password value based on the type
|
||||
if (type == "add") {
|
||||
document.getElementById("password-add").value = password;
|
||||
} else if (type == "edit") {
|
||||
console.log("password-edit-"+id.toString());
|
||||
document.getElementById("password-edit-"+id.toString()).value = password;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.authMethod').on('change', function() {
|
||||
var $form = $(this).closest('.authForm');
|
||||
|
||||
Reference in New Issue
Block a user