mirror of
https://github.com/itsdave-de/msp.git
synced 2025-05-06 15:35:12 +02:00
Add Password Generator
Add CIDR Netmasks
This commit is contained in:
parent
5111280392
commit
7374e1a6b5
@ -46,7 +46,7 @@
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "CIDR Mask",
|
||||
"options": "24\n25\n26\n27\n28\n29\n30\n31\n32",
|
||||
"options": "24\n16\n12\n8\n32\n31\n30\n29\n28\n27\n26\n25\n23\n22\n21\n20\n19\n18\n17\n15\n14\n13\n11\n10\n9\n7\n6\n5\n4\n3\n2\n1",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
@ -147,7 +147,7 @@
|
||||
"label": "Aditional Data"
|
||||
}
|
||||
],
|
||||
"modified": "2021-03-24 00:12:13.023565",
|
||||
"modified": "2021-03-29 15:19:10.791248",
|
||||
"modified_by": "Administrator",
|
||||
"module": "MSP",
|
||||
"name": "IP Network",
|
||||
|
@ -4,6 +4,7 @@
|
||||
frappe.ui.form.on('IT User Account', {
|
||||
refresh: function(frm) {
|
||||
frm.add_custom_button('Copy PW', () => frm.trigger('get_pw'));
|
||||
frm.add_custom_button('Generate PW', () => frm.trigger('generate_new_pw'));
|
||||
|
||||
},
|
||||
get_pw: function(frm) {
|
||||
@ -15,6 +16,16 @@ frappe.ui.form.on('IT User Account', {
|
||||
frm.events.CopyToClipboard(r.message)
|
||||
}
|
||||
);
|
||||
},
|
||||
generate_new_pw: function(frm) {
|
||||
frm.call('generate_new_pw', {
|
||||
},
|
||||
(r) => {
|
||||
frm.events.CopyToClipboard(r.message);
|
||||
frm.set_value()("password", r.message);
|
||||
frm.save()
|
||||
}
|
||||
);
|
||||
},
|
||||
CopyToClipboard: function(value) {
|
||||
var tempInput = document.createElement("input");
|
||||
|
@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from passwordgenerator import pwgenerator
|
||||
|
||||
class ITUserAccount(Document):
|
||||
|
||||
@ -23,3 +24,10 @@ class ITUserAccount(Document):
|
||||
self.save()
|
||||
"""
|
||||
return(self.get_password("password"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def generate_new_pw(self):
|
||||
new_password = pwgenerator.generate()
|
||||
print(new_password)
|
||||
return(new_password)
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
frappe
|
||||
ipaddress
|
||||
passwordgenerator
|
Loading…
x
Reference in New Issue
Block a user