summaryrefslogtreecommitdiffstats
path: root/idp/extra/modules/identities_ui.ptl
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@0d.be>2008-05-09 13:42:10 (GMT)
committerFrederic Peters <fpeters@0d.be>2008-05-09 13:42:10 (GMT)
commitbe46cad4b7de435bac68a7ce637d5a2735e2148b (patch)
tree1cfce72b3c1a8236b4653861b6085a23da34f0c3 /idp/extra/modules/identities_ui.ptl
parent19c2edf669bbb46e0a82a9b8451c247fe2e06c52 (diff)
downloadpratic-be46cad4b7de435bac68a7ce637d5a2735e2148b.zip
pratic-be46cad4b7de435bac68a7ce637d5a2735e2148b.tar.gz
pratic-be46cad4b7de435bac68a7ce637d5a2735e2148b.tar.bz2
possibility to set password on account creation
Diffstat (limited to 'idp/extra/modules/identities_ui.ptl')
-rw-r--r--idp/extra/modules/identities_ui.ptl17
1 files changed, 16 insertions, 1 deletions
diff --git a/idp/extra/modules/identities_ui.ptl b/idp/extra/modules/identities_ui.ptl
index 5960bfc..72c3f1c 100644
--- a/idp/extra/modules/identities_ui.ptl
+++ b/idp/extra/modules/identities_ui.ptl
@@ -6,7 +6,7 @@ from quixote.directory import Directory
from qommon.backoffice.menu import html_top
from qommon.admin.menu import command_icon
-from qommon import errors
+from qommon import errors, get_cfg
from qommon.form import *
import string
@@ -440,6 +440,21 @@ class IdentitiesDirectory(Directory):
form.add(StringWidget, 'sn', title = _('Last Name'), required = True, size = 30)
form.add(StringWidget, 'givenName', title = _('First Name'), required = True, size = 30)
form.add(StringWidget, 'mail', title = _('Mail'), size = 30, required = True)
+
+ passwords_cfg = get_cfg('passwords', {})
+ min_len = passwords_cfg.get('min_length', 0)
+ max_len = passwords_cfg.get('max_length', 0)
+ if min_len == 0 and max_len == 0:
+ password_len = 6
+ elif min_len == 0:
+ password_len = min(6, max_len)
+ elif max_len == 0:
+ password_len = max(6, min_len)
+ else:
+ password_len = (max_len + min_len) / 2
+
+ form.add(StringWidget, 'password', title = _('Password'), size = 30, required = True,
+ value = ''.join([random.choice(string.letters) for x in range(password_len)]))
form.add_submit('submit', _('Submit'))
form.add_submit('cancel', _('Cancel'))