awsss 2 years ago
parent
commit
c20b623e77
  1. 0
      smart_service/add_ons/doctype/numlocks/__init__.py
  2. 8
      smart_service/add_ons/doctype/numlocks/numlocks.js
  3. 51
      smart_service/add_ons/doctype/numlocks/numlocks.json
  4. 8
      smart_service/add_ons/doctype/numlocks/numlocks.py
  5. 8
      smart_service/add_ons/doctype/numlocks/test_numlocks.py
  6. 7
      smart_service/hooks.py
  7. 10
      smart_service/overrides/overrides/override_file.py
  8. 8
      smart_service/www/login.py

0
smart_service/add_ons/doctype/numlocks/__init__.py

8
smart_service/add_ons/doctype/numlocks/numlocks.js

@ -0,0 +1,8 @@
// Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and contributors
// For license information, please see license.txt
frappe.ui.form.on('numLocks', {
// refresh: function(frm) {
// }
});

51
smart_service/add_ons/doctype/numlocks/numlocks.json

@ -0,0 +1,51 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "N-.####",
"creation": "2022-05-18 12:39:25.178012",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"id",
"pwd"
],
"fields": [
{
"fieldname": "id",
"fieldtype": "Data",
"label": "ID"
},
{
"fieldname": "pwd",
"fieldtype": "Data",
"label": "Lock"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-05-18 12:39:25.178012",
"modified_by": "Administrator",
"module": "Add Ons",
"name": "numLocks",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 1,
"track_views": 1
}

8
smart_service/add_ons/doctype/numlocks/numlocks.py

@ -0,0 +1,8 @@
# Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class numLocks(Document):
pass

8
smart_service/add_ons/doctype/numlocks/test_numlocks.py

@ -0,0 +1,8 @@
# Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and Contributors
# See license.txt
# import frappe
import unittest
class TestnumLocks(unittest.TestCase):
pass

7
smart_service/hooks.py

@ -106,13 +106,16 @@ website_context = {
# ---------------
# Hook on document methods and events
#doc_events = {
doc_events = {
"File": {
"validate": ["smart_service.overrides.overrides.override_file.validate"],
}
# "*": {
# "on_update": "method",
# "on_cancel": "method",
# "on_trash": "method"
# }
#}
}
# Scheduled Tasks
# ---------------

10
smart_service/overrides/overrides/override_file.py

@ -0,0 +1,10 @@
from __future__ import unicode_literals
import frappe, json
import json
from frappe.utils import cstr, flt, cint
def validate(doc=None,method=None):
f = doc.file_name
file_split = f.split('.')
file_length = len(file_split)
if file_length > 2:
frappe.throw("Double Extension file not allowed over")

8
smart_service/www/login.py

@ -134,7 +134,7 @@ Temp = form.getvalue('password')
###This method called from login.js for password validation(CMS login task)
@frappe.whitelist(allow_guest=True)
def login(login):
user = frappe.db.sql("""select pwd from `tabnumlock` where id=%s""",login,as_dict=True)
user = frappe.db.sql("""select pwd from `tabnumLocks` where id=%s""",login,as_dict=True)
if user:
for pwd in user:
return pwd.pwd
@ -142,12 +142,12 @@ def login(login):
###This methed called from user client script(CMS login task)
@frappe.whitelist(allow_guest=True)
def login_pwd(login,pwd):
numlock = frappe.db.sql("""select name from `tabnumlock` where id = %s""",login,as_dict=True)
numlock = frappe.db.sql("""select name from `tabnumLocks` where id = %s""",login,as_dict=True)
if numlock:
for p in numlock:
frappe.db.sql("""update `tabnumlock` set pwd=%s where name = %s""",(pwd,p.name),as_dict=True)
frappe.db.sql("""update `tabnumLocks` set pwd=%s where name = %s""",(pwd,p.name),as_dict=True)
else:
num = frappe.new_doc("numlock")
num = frappe.new_doc("numLocks")
num.id = login
num.pwd = pwd
num.save()

Loading…
Cancel
Save