From aeb5d8c5843774e41943668051c503adc66e80fe Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Fri, 2 Feb 2018 14:51:20 +0530 Subject: [PATCH 1/2] Added Session and Password Controller --- client/view/controls/index.js | 3 ++- client/view/controls/password.js | 10 ++++++++++ models/doctype/session/session.js | 17 +++++++++++++++++ models/doctype/session/session.json | 27 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 client/view/controls/password.js create mode 100644 models/doctype/session/session.js create mode 100644 models/doctype/session/session.json diff --git a/client/view/controls/index.js b/client/view/controls/index.js index 88ea9d01..3b49692f 100644 --- a/client/view/controls/index.js +++ b/client/view/controls/index.js @@ -4,7 +4,8 @@ const control_classes = { Select: require('./select'), Link: require('./link'), Float: require('./float'), - Currency: require('./currency') + Currency: require('./currency'), + Password: require('./password') } module.exports = { diff --git a/client/view/controls/password.js b/client/view/controls/password.js new file mode 100644 index 00000000..27d7b9a4 --- /dev/null +++ b/client/view/controls/password.js @@ -0,0 +1,10 @@ +const BaseControl = require('./base'); + +class PasswordControl extends BaseControl { + make() { + super.make(); + this.input.setAttribute('type', 'password'); + } +}; + +module.exports = PasswordControl; \ No newline at end of file diff --git a/models/doctype/session/session.js b/models/doctype/session/session.js new file mode 100644 index 00000000..be67303f --- /dev/null +++ b/models/doctype/session/session.js @@ -0,0 +1,17 @@ +const BaseMeta = require('frappejs/model/meta'); +const BaseDocument = require('frappejs/model/document'); + +class SessionMeta extends BaseMeta { + setup_meta() { + Object.assign(this, require('./session.json')); + } +} + +class Session extends BaseDocument { + +} + +module.exports = { + Document: Session, + Meta: SessionMeta +}; \ No newline at end of file diff --git a/models/doctype/session/session.json b/models/doctype/session/session.json new file mode 100644 index 00000000..185b092c --- /dev/null +++ b/models/doctype/session/session.json @@ -0,0 +1,27 @@ +{ + "name": "Session", + "doctype": "DocType", + "is_single": 0, + "is_child": 0, + "keyword_fields": [], + "fields": [ + { + "fieldname": "name", + "label": "Name", + "fieldtype": "Data", + "reqd": 1 + }, + { + "fieldname": "username", + "label": "Username", + "fieldtype": "Data", + "reqd": 1 + }, + { + "fieldname": "password", + "label": "Password", + "fieldtype": "Password", + "reqd": 1 + } + ] +} \ No newline at end of file From d42031ad9bd22970012952514d88b23919f3b9c5 Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Fri, 2 Feb 2018 14:57:10 +0530 Subject: [PATCH 2/2] Save Random Session Field --- models/doctype/session/session.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/models/doctype/session/session.json b/models/doctype/session/session.json index 185b092c..8fad546c 100644 --- a/models/doctype/session/session.json +++ b/models/doctype/session/session.json @@ -5,12 +5,6 @@ "is_child": 0, "keyword_fields": [], "fields": [ - { - "fieldname": "name", - "label": "Name", - "fieldtype": "Data", - "reqd": 1 - }, { "fieldname": "username", "label": "Username",