Add reg_nip attribute and NIP validation to registration schema

1 parent 86845312
......@@ -424,6 +424,7 @@ class BaseApp():
self.reg_captcha = 0
self.login_captcha = 0
self.base_dir = os.path.split(__file__)[0]
self.reg_nip = 0
def get_route_file(self, filename="routes.csv"):
fullpath = os.path.join(self.base_dir, 'scripts', 'data', filename)
......@@ -456,6 +457,7 @@ class BaseApp():
self.reg_form = get_params("reg_form", 'base-register')
self.reg_id_card = get_params(
"reg_id_card", 0, settings=settings)
self.reg_nip = int(settings.get("reg_nip", 0))
self.reg_captcha = get_params(
"reg_captcha", 0, settings=settings)
self.captcha_files = os.path.join(self.temp_files, "captcha")+os.sep
......
......@@ -9,7 +9,7 @@ log = logging.getLogger(__name__)
lima_menit = 300
#
def auth_from(request, field=None):
global lima_menit
env = request.environ
......
......@@ -124,6 +124,15 @@ class AddSchema(colander.Schema):
title=_("ID Card"),
validator=image_validator)
if BASE_CLASS.reg_nip:
self["nip"] = colander.SchemaNode(
colander.String(),
title=_("NIP"),
validator=colander.Length(max=18, min=18),
missing=colander.drop,
oid="nip")
if not request.user and BASE_CLASS.reg_captcha:
self["captcha"] = colander.SchemaNode(
colander.String(),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!