Skip to content

Commit 8d45a1b

Browse files
author
Richard Jones
committed
password edit now has a confirmation field
registration error punts back to register page
1 parent 766e3e6 commit 8d45a1b

File tree

7 files changed

+53
-22
lines changed

7 files changed

+53
-22
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ are given with the most recent entry first.
44
2002-09-?? 0.5.0 ????
55
. handling of None for Date/Interval/Password values in export/import
66
. handling of journal values in export/import
7+
. password edit now has a confirmation field
8+
. registration error punts back to register page
9+
710

811
2002-09-13 0.5.0 beta2
912
. all backends now have a .close() method, and it's used everywhere

TODO.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ pending web rewritten documentation (can come after the beta though so
5353
customisation doc
5454
pending web allow multilink selections to select a "none" element to allow
5555
people with broken browsers to select nothing?
56-
pending web password edit fields should always appear in pairs - for
57-
confirmation
58-
pending web write a _generic.item
59-
pending dist include the HTML in docs
6056

6157
bug web request.url is incorrect in cgi-bin environments
6258
bug web do something about file.newitem

doc/customizing.txt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.34 $
5+
:Version: $Revision: 1.35 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -951,9 +951,9 @@ _value the value of the property if any
951951

952952
There are several methods available on these wrapper objects:
953953

954-
=========== =============================================================
954+
=========== =================================================================
955955
Method Description
956-
=========== =============================================================
956+
=========== =================================================================
957957
plain render a "plain" representation of the property
958958
field render a form edit field for the property
959959
stext only on String properties - render the value of the
@@ -963,6 +963,9 @@ multiline only on String properties - render a multiline form edit
963963
field for the property
964964
email only on String properties - render the value of the
965965
property as an obscured email address
966+
confirm only on Password properties - render a second form edit field for
967+
the property, used for confirmation that the user typed the
968+
password correctly. Generates a field with name "name:confirm".
966969
reldate only on Date properties - render the interval between the
967970
date and now
968971
pretty only on Interval properties - render the interval in a
@@ -971,7 +974,7 @@ menu only on Link and Multilink properties - render a form select
971974
list for this property
972975
reverse only on Multilink properties - produce a list of the linked
973976
items in reverse order
974-
=========== =============================================================
977+
=========== =================================================================
975978

976979
The request variable
977980
~~~~~~~~~~~~~~~~~~~~
@@ -982,9 +985,9 @@ The request variable is packed with information about the current request.
982985

983986
.. taken from roundup.cgi.templating.HTMLRequest docstring
984987

985-
=========== ================================================================
988+
=========== =================================================================
986989
Variable Holds
987-
=========== ================================================================
990+
=========== =================================================================
988991
form the CGI form as a cgi.FieldStorage
989992
env the CGI environment variables
990993
url the current URL path for this request
@@ -993,13 +996,13 @@ user a HTMLUser instance for this user
993996
classname the current classname (possibly None)
994997
template the current template (suffix, also possibly None)
995998
form the current CGI form variables in a FieldStorage
996-
=========== ================================================================
999+
=========== =================================================================
9971000

9981001
**Index page specific variables (indexing arguments)**
9991002

1000-
=========== ================================================================
1003+
=========== =================================================================
10011004
Variable Holds
1002-
=========== ================================================================
1005+
=========== =================================================================
10031006
columns dictionary of the columns to display in an index page
10041007
show a convenience access to columns - request/show/colname will
10051008
be true if the columns should be displayed, false otherwise
@@ -1008,13 +1011,13 @@ group index grouping property (direction, column name)
10081011
filter properties to filter the index on
10091012
filterspec values to filter the index on
10101013
search_text text to perform a full-text search on for an index
1011-
=========== ================================================================
1014+
=========== =================================================================
10121015

10131016
There are several methods available on the request variable:
10141017

1015-
=============== ============================================================
1018+
=============== =============================================================
10161019
Method Description
1017-
=============== ============================================================
1020+
=============== =============================================================
10181021
description render a description of the request - handle for the page
10191022
title
10201023
indexargs_form render the current index args as form elements
@@ -1024,7 +1027,7 @@ base_javascript render some javascript that is used by other components of
10241027
batch run the current index args through a filter and return a
10251028
list of items (see `hyperdb item wrapper`_, and
10261029
`batching`_)
1027-
=============== ============================================================
1030+
=============== =============================================================
10281031

10291032
The form variable
10301033
:::::::::::::::::
@@ -1067,11 +1070,11 @@ The util variable
10671070

10681071
Note: this is implemented by the roundup.cgi.templating.TemplatingUtils class.
10691072

1070-
=============== ============================================================
1073+
=============== =============================================================
10711074
Method Description
1072-
=============== ============================================================
1075+
=============== =============================================================
10731076
Batch return a batch object using the supplied list
1074-
=============== ============================================================
1077+
=============== =============================================================
10751078

10761079
Batching
10771080
::::::::

roundup/cgi/client.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.32 2002-09-13 00:08:44 richard Exp $
1+
# $Id: client.py,v 1.33 2002-09-15 22:41:15 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -596,6 +596,7 @@ def registerAction(self):
596596
self.db.commit()
597597
except ValueError, message:
598598
self.error_message.append(message)
599+
return
599600

600601
# log the new user in
601602
self.user = cl.get(self.userid, 'username')
@@ -1134,6 +1135,14 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')):
11341135
if not value:
11351136
# ignore empty password values
11361137
continue
1138+
if not form.has_key('%s:confirm'%key):
1139+
raise ValueError, 'Password and confirmation text do not match'
1140+
confirm = form['%s:confirm'%key]
1141+
if isinstance(confirm, type([])):
1142+
raise ValueError, 'You have submitted more than one value'\
1143+
' for the %s property'%key
1144+
if value != confirm.value:
1145+
raise ValueError, 'Password and confirmation text do not match'
11371146
value = password.Password(value)
11381147
elif isinstance(proptype, hyperdb.Date):
11391148
if value:

roundup/cgi/templating.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,18 @@ def plain(self):
767767
return _('*encrypted*')
768768

769769
def field(self, size = 30):
770-
''' Render a form edit field for the property
770+
''' Render a form edit field for the property.
771771
'''
772772
return '<input type="password" name="%s" size="%s">'%(self._name, size)
773773

774+
def confirm(self, size = 30):
775+
''' Render a second form edit field for the property, used for
776+
confirmation that the user typed the password correctly. Generates
777+
a field with name "name:confirm".
778+
'''
779+
return '<input type="password" name="%s:confirm" size="%s">'%(
780+
self._name, size)
781+
774782
class NumberHTMLProperty(HTMLProperty):
775783
def plain(self):
776784
''' Render a "plain" representation of the property

roundup/templates/classic/html/user.item

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ You are not allowed to view this page.
2121
<th>Login Password</th>
2222
<td tal:content="structure context/password/field">password</td>
2323
</tr>
24+
<tr>
25+
<th>Confirm Password</th>
26+
<td tal:content="structure context/password/confirm">password</td>
27+
</tr>
2428
<tr tal:condition="python:request.user.hasPermission('Web Roles')">
2529
<th>Roles</th>
2630
<td tal:condition="context/id"

roundup/templates/classic/html/user.register

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ You are not allowed to view this page.
88

99
<tal:block tal:condition="editok">
1010
<form method="POST" onSubmit="return submit_once()" enctype="multipart/form-data">
11+
<input type="hidden" name=":template" value="register">
12+
<input type="hidden" name=":required" value="username">
13+
<input type="hidden" name=":required" value="password">
14+
<input type="hidden" name=":required" value="address">
1115

1216
<table class="form">
1317
<tr>
@@ -22,6 +26,10 @@ You are not allowed to view this page.
2226
<th>Login Password</th>
2327
<td tal:content="structure context/password/field">password</td>
2428
</tr>
29+
<tr>
30+
<th>Confirm Password</th>
31+
<td tal:content="structure context/password/confirm">password</td>
32+
</tr>
2533
<tr tal:condition="python:request.user.hasPermission('Web Roles')">
2634
<th>Roles</th>
2735
<td tal:condition="exists:item"

0 commit comments

Comments
 (0)