Commit 905e6dad by aa.gusti

verifikasi registrasi

1 parent 9116a98a
......@@ -323,6 +323,8 @@ def get_host(request):
host = f"{proto}://{request.host}"
return host
def get_home(request):
return request.route_url('home')
def set_routes(config, app_id=None):
q = DBSession.query(Route)
......@@ -405,6 +407,7 @@ def main(global_config, **settings):
config.add_request_method(thousand, 'thousand', reify=True)
config.add_request_method(is_devel, 'devel', reify=True)
config.add_request_method(get_host, '_host', reify=True)
config.add_request_method(get_home, 'home', reify=True)
# config.add_request_method(api_has_permission_, 'api_has_permission', reify=True)
config.add_request_method(google_signin_client_id, 'google_signin_client_id', reify=True)
......
......@@ -196,7 +196,8 @@ button {
}
.panel-info {
border-color: #1956af
/*border-color: #1956af*/
border-color: #57889c
}
.panel-warning {
......@@ -217,8 +218,10 @@ button {
.panel-info>.panel-heading {
color: #fff;
background-color: #1956af;
border-color: #1956af
/*background-color: #1956af;*/
background-color: #57889c;
border-color: #57889c
/*border-color: #1956af*/
}
.panel-warning>.panel-heading {
......
......@@ -112,6 +112,7 @@ class BaseView(object):
self.add_schema = ""
self.table = ""
self.home = self.req.route_url('home')[:-1]
self.form_validator = None
def route_list(self, msg=None, error=""):
if msg:
......@@ -197,6 +198,10 @@ class BaseView(object):
d = row.to_dict()
if 'tanggal' in d and d['tanggal']:
d["tanggal"] = dmy(row.tanggal)
for f in d:
if type(d[f]) is str:
d[f]=d[f].strip()
return d
def view_edit(self):
......@@ -216,7 +221,8 @@ class BaseView(object):
self.save_request(dict(controls), row)
return self.route_list()
form.set_appstruct(self.get_values(row))
values = self.get_values(row)
form.set_appstruct(values)
return dict(form=form.render(), scripts=self.form_scripts)
def view_delete(self):
......
"""
Module registasi digunakan untuk registrasi pengguna secara online
URL: http://server/register
Rule registrasi
1. User melengkapi data registrasi termasuk photo kartu identitas
2. System memberikan response kepada user registrasi sudah ditermia dan dalam tahap verifikasi
status = 0 (tidak aktif)
3. Petugas melakukan verifikasi user
a. Approve Apabila NIK(kode) sama dengan photo Kartu Identitas (Status=1)
b. Tolak apabila NIK(kode) berbeda dengan photo Kartu Identitas (Status=-1)
4. System mengirim email hasil verifikasi
a. Approve berisi email persetujuan yang berisi link sekali click
b. Reject berisi email penolakan dyang didalamnya berisi juga link untuk edit data
apabila user akan melakukan edit data.
Link ini hanya bisa membuka data user yang status=-1
Parameter (Config)
1. base_register_approve: approve_file_template.tpl
2. base_register_reject: approve_file_template.tpl
File template tersebut dapat diunggah
Link dalam module registrasi:
1. Form registrasi http://server/register
2. List User yang melakukan registrasi yangu statusn=0 http://server/register/list
3. Form Verifikasi http://server/register/{uid}/verifikasi
4. Form edit registrasi http://server/register/{uid}/edit
5. Form Upload template
"""
import os
import re
from email.utils import parseaddr
......
<html metal:use-macro="load: ./base_list.pt"
tal:define="
home request.route_url('home');">
<html metal:use-macro="load: ./base_list.pt">
<div metal:fill-slot="content">
<div class="jarviswidget jarviswidget-color-blueLight"> <!-- jarviswidget -->
<header role="heading" class="txt-color-grayDark">
......@@ -25,12 +23,13 @@
</div> <!-- widget-body -->
</div>
</div>
</div> <!-- metal:content -->
</div>
<!-- metal:content -->
<script metal:fill-slot="scripts">
var mID;
var oTable;
var oTableUri = "${home}/${url}"
var oTableUrl = oTableUri + "/grid/act";
//var oTableUri = "${home}/${url}"
//var oTableUrl = oTableUri + "/grid/act";
var columnDefs =${structure:col_defs};
......
<form
tal:define="style style|field.widget.style;
css_class css_class|string:${field.widget.css_class or field.css_class or ''};
item_template item_template|field.widget.item_template;
autocomplete autocomplete|field.autocomplete;
title title|field.title;
errormsg errormsg|field.errormsg;
description description|field.description;
buttons buttons|field.buttons;
use_ajax use_ajax|field.use_ajax;
ajax_options ajax_options|field.ajax_options;
formid formid|field.formid;
action action|field.action or None;
method method|field.method;"
tal:attributes="autocomplete autocomplete;
style style;
class css_class;
action action;
attributes|field.widget.attributes|{};"
id="${formid}"
method="${method}"
enctype="multipart/form-data"
accept-charset="utf-8"
class="deform ${field.bootstrap_form_style | 'form-horizontal'}"
i18n:domain="deform"
tal:define="style style|field.widget.style;
css_class css_class|string:${field.widget.css_class or field.css_class or ''};
item_template item_template|field.widget.item_template;
autocomplete autocomplete|field.autocomplete;
title title|field.title;
errormsg errormsg|field.errormsg;
description description|field.description;
buttons buttons|field.buttons;
use_ajax use_ajax|field.use_ajax;
ajax_options ajax_options|field.ajax_options;
formid formid|field.formid;
action action|field.action or None;
method method|field.method;"
tal:attributes="autocomplete autocomplete;
style style;
class css_class;
action action;
attributes|field.widget.attributes|{};"
id="${formid}"
method="${method}"
enctype="multipart/form-data"
accept-charset="utf-8"
class="deform ${field.bootstrap_form_style | 'form-horizontal'}"
i18n:domain="deform"
>
<fieldset class="deform-form-fieldset">
<div class="row">
<legend tal:condition="title">${title}</legend>
<input type="hidden" name="_charset_"/>
<input type="hidden" name="__formid__" value="${formid}"/>
<div class="alert alert-danger" tal:condition="field.error">
<div class="error-msg-lbl" i18n:translate=""
>There was a problem with your submission
<fieldset class="deform-form-fieldset">
<div class="row">
<legend tal:condition="title">${title}</legend>
<input type="hidden" name="_charset_"/>
<input type="hidden" name="__formid__" value="${formid}"/>
<div class="alert alert-danger" tal:condition="field.error">
<div class="error-msg-lbl" i18n:translate="">There was a problem with your submission</div>
<div class="error-msg-detail" i18n:translate="">Errors have been highlighted below</div>
<p class="error-msg">${field.errormsg}</p>
</div>
<p class="section first" tal:condition="description">
${description}
</p>
<div tal:repeat="child field"
tal:replace="structure child.render_template(item_template)"/>
</div>
<div class="error-msg-detail" i18n:translate=""
>Errors have been highlighted below
<div class="row">
<div class="form-group deform-form-buttons">
<tal:loop tal:repeat="button buttons">
<button
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';"
tal:attributes="disabled button.disabled if button.disabled else None;
attributes|button.attributes|{};"
id="${formid+button.name}"
name="${button.name}"
type="${button.type}"
class="btn ${button.css_class or btn_disposition}"
value="${button.value}"
tal:condition="button.type != 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</button>
<a
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';
btn_href button.value|''"
class="btn ${button.css_class or btn_disposition}"
id="${field.formid + button.name}"
href="${btn_href}"
tal:condition="button.type == 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</a>
</tal:loop>
</div>
</div>
<p class="error-msg">${field.errormsg}</p>
</div>
</fieldset>
<p class="section first" tal:condition="description">
${description}
</p>
<div tal:repeat="child field"
tal:replace="structure child.render_template(item_template)"/>
</div>
<div class="row">
<div class="form-group deform-form-buttons">
<tal:loop tal:repeat="button buttons">
<button
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';"
tal:attributes="disabled button.disabled if button.disabled else None;
attributes|button.attributes|{};"
id="${formid+button.name}"
name="${button.name}"
type="${button.type}"
class="btn ${button.css_class or btn_disposition}"
value="${button.value}"
tal:condition="button.type != 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</button>
<a
tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default';
btn_href button.value|''"
class="btn ${button.css_class or btn_disposition}"
id="${field.formid + button.name}"
href="${btn_href}"
tal:condition="button.type == 'link'">
<span tal:condition="button.icon" class="glyphicon glyphicon-${button.icon}"></span>
${button.title}
</a>
</tal:loop>
</div>
</div>
</fieldset>
<script type="text/javascript" tal:condition="use_ajax">
deform.addCallback(
'${formid}',
function(oid) {
var target = '#' + oid;
var options = {
target: target,
replaceTarget: true,
success: function() {
deform.processCallbacks();
deform.focusFirstInput(target);
},
beforeSerialize: function() {
// See http://bit.ly/1agBs9Z (hack to fix tinymce-related ajax bug)
if ('tinymce' in window) {
$(tinymce.get()).each(
function(i, el) {
var content = el.getContent();
var editor_input = document.getElementById(el.id);
editor_input.value = content;
});
}
}
};
var extra_options = ${ajax_options} || {};
$('#' + oid).ajaxForm($.extend(options, extra_options));
}
);
</script>
<script type="text/javascript" tal:condition="use_ajax">
deform.addCallback(
'${formid}',
function (oid) {
var target = '#' + oid;
var options = {
target: target,
replaceTarget: true,
success: function () {
deform.processCallbacks();
deform.focusFirstInput(target);
},
beforeSerialize: function () {
// See http://bit.ly/1agBs9Z (hack to fix tinymce-related ajax bug)
if ('tinymce' in window) {
$(tinymce.get()).each(
function (i, el) {
var content = el.getContent();
var editor_input = document.getElementById(el.id);
editor_input.value = content;
});
}
}
};
var extra_options = ${ajax_options} ||
{
}
;
$('#' + oid).ajaxForm($.extend(options, extra_options));
}
);
</script>
</form>
......@@ -4,7 +4,7 @@
item_template item_template|field.widget.item_template"
i18n:domain="deform">
<div class="panel panel-default" title="${description}">
<div class="panel panel-info" title="${description}">
<div class="panel-heading">${title}</div>
<div class="panel-body">
......
......@@ -20,7 +20,8 @@
</a>
</div>
<div id="collapse-${field.oid}" class="panel-collapse deform-collapse-body collapse ${collapse_body_class}" role="tabpanel" aria-labelledby="heading-${field.oid}">
<div id="collapse-${field.oid}" class="panel-collapse deform-collapse-body collapse ${collapse_body_class}"
role="tabpanel" aria-labelledby="heading-${field.oid}">
<div class="panel-body">
......
<input
tal:define="autofocus autofocus|field.autofocus"
type="password"
name="${name|field.name}"
value="${field.widget.redisplay and cstruct or ''}"
tal:attributes="style style|field.widget.style;
class string: form-control ${css_class|field.widget.css_class or ''};
autofocus autofocus;
attributes|field.widget.attributes|{};"
id="${oid|field.oid}"/>
......@@ -152,41 +152,41 @@ class DeTable(field.Field):
if hasattr(f, 'width'):
d["width"] = f.width
data.append(f'width: "{f.width}"')
data.append(f"width: '{f.width}'")
if hasattr(f, 'aligned'):
d["className"] = f.aligned
data.append(f'className: "{f.aligned}"')
data.append(f"className: {f.aligned}")
if hasattr(f, 'searchable'):
d["searchable"] = f.searchable
data.append(f'searchable: {f.searchable}')
data.append(f"searchable: {f.searchable}")
if hasattr(f, 'visible'):
d["visible"] = f.visible
data.append(f'visible: "{f.visible}"')
data.append(f"visible: {f.visible}")
if hasattr(f, 'orderable'):
d["orderable"] = f.orderable
data.append(f'orderable: {f.orderable}')
data.append(f"orderable: {f.orderable}")
thousand = hasattr(f, 'thousand') and f.thousand or None
separator = thousand and "separator" in thousand and thousand["separator"] or ','
decimal = thousand and "decimal" in thousand and thousand["decimal"] or '.'
point = thousand and "point" in thousand and thousand["point"] or 2
currency = thousand and "currency" in thousand and thousand["currency"] or ""
if thousand or type(f.typ)==colander.Float():
d["renderer"]=f"$.fn.dataTable.render.number( '{separator}', '{decimal}', {point}, '{currency}' )"
if 'className' not in d:
d["className"] = "text-right"
data.append(f'renderer: $.fn.dataTable.render.number( "{separator}", "{decimal}", {point}, "{currency}" )')
# thousand = hasattr(f, 'thousand') and f.thousand or None
# separator = thousand and "separator" in thousand and thousand["separator"] or ','
# decimal = thousand and "decimal" in thousand and thousand["decimal"] or '.'
# point = thousand and "point" in thousand and thousand["point"] or 2
# currency = thousand and "currency" in thousand and thousand["currency"] or ""
# if thousand or type(f.typ)==colander.Float():
# d["renderer"]=f"$.fn.dataTable.render.number( '{separator}', '{decimal}', {point}, '{currency}' )"
# if 'className' not in d:
# d["className"] = "text-right"
# data.append(f'renderer: $.fn.dataTable.render.number( "{separator}", "{decimal}", {point}, "{currency}" )')
columns.append(d)
cols2.append(data)
self.columns = json.dumps(columns)
# self.columns = columns
self.columns = json.dumps(cols2)
# self.columns = json.dumps(cols2)
self.url = action
self.url_suffix = action_suffix
......
......@@ -68,7 +68,7 @@
processing: true,
serverSide: true,
ajax: o${tableid}Url,
stateSave: true,
stateSave: false,
scrollCollapse: true,
sort: true,
info: false,
......@@ -81,7 +81,7 @@
[10, 25, 50, 100],
[10, 25, 50, 100]
],
//columnDefs: columnDefs,
// columnDefs: [{ "visible": false, "searchable": false, "orderable": false, "targets": [0] }],
columns: ${columns},
"language": language,
......
......@@ -19,7 +19,7 @@ six~=1.16.0
Mako~=1.1.4
Babel~=2.9.1
Beaker~=1.11.0
Pygments~=2.9.0
Pygments~=2.10.0
MarkupSafe~=2.0.1
Genshi~=0.7.5
pytz~=2021.1
......@@ -31,8 +31,8 @@ google~=3.0.0
cachetools~=4.2.2
certifi~=2021.5.30
urllib3~=1.26.6
requests~=2.25.1
google-api-python-client~=2.15.0
requests~=2.26.0
google-api-python-client~=2.19.0
python-dateutil~=2.8.2
alembic~=1.6.5
passlib~=1.7.4
......@@ -46,12 +46,18 @@ httplib2~=0.19.1
icecream~=2.1.1
executing~=0.8.0
paginate~=0.5.6
idna~=2.10
idna~=3.2
chardet~=4.0.0
asttokens~=2.0.5
setuptools~=57.0.0
setuptools~=56.0.0
uritemplate~=3.0.1
zipp~=3.5.0
reportlab~=3.5.68
reportlab~=3.6.1
PyJWT~=2.1.0
qrcode~=6.1
\ No newline at end of file
qrcode~=7.3.1
py~=1.11.0
attrs~=21.4.0
toml~=0.10.2
pytest~=7.1.1
pluggy~=1.0.0
iniconfig~=1.1.1
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!