@@ -185,8 +185,9 @@ class ValidPassword(formencode.validator
class ValidPasswordsMatch(formencode.validators.FancyValidator):
def validate_python(self, value, state):
if value['password'] != value['password_confirmation']:
pass_val = value.get('password') or value.get('new_password')
if pass_val != value['password_confirmation']:
e_dict = {'password_confirmation':
_('Passwords do not match')}
raise formencode.Invalid('', value, state, error_dict=e_dict)
@@ -497,8 +498,6 @@ class LoginForm(formencode.Schema):
'tooShort':_('Enter %(min)i characters or more')}
)
#chained validators have access to all data
chained_validators = [ValidAuth]
def UserForm(edit=False, old_data={}):
@@ -509,15 +508,18 @@ def UserForm(edit=False, old_data={}):
ValidUsername(edit, old_data))
if edit:
new_password = All(UnicodeString(strip=True, min=6, not_empty=False))
password_confirmation = All(UnicodeString(strip=True, min=6, not_empty=False))
admin = StringBoolean(if_missing=False)
else:
password = All(UnicodeString(strip=True, min=6, not_empty=True))
active = StringBoolean(if_missing=False)
name = UnicodeString(strip=True, min=1, not_empty=True)
lastname = UnicodeString(strip=True, min=1, not_empty=True)
email = All(Email(not_empty=True), UniqSystemEmail(old_data))
chained_validators = [ValidPassword]
chained_validators = [ValidPasswordsMatch, ValidPassword]
return _UserForm
@@ -44,7 +44,16 @@
${h.password('password',class_='small')}
</div>
<div class="field">
<div class="label">
<label for="password_confirmation">${_('Password confirmation')}:</label>
<div class="input">
${h.password('password_confirmation',class_="small",autocomplete="off")}
<label for="name">${_('First Name')}:</label>
@@ -68,7 +68,16 @@
${h.password('new_password',class_='medium',autocomplete="off")}
<label for="password_confirmation">${_('New password confirmation')}:</label>
${h.password('password_confirmation',class_="medium",autocomplete="off")}
@@ -57,7 +57,16 @@
${h.password('new_password',class_="medium",autocomplete="off")}
@@ -154,10 +163,12 @@
</tr>
%endfor
%else:
<div style="padding:5px 0px 10px 0px;">
${_('No repositories yet')}
%if h.HasPermissionAny('hg.admin','hg.create.repository')():
${h.link_to(_('create one now'),h.url('admin_settings_create_repository'))}
${h.link_to(_('create one now'),h.url('admin_settings_create_repository'),class_="ui-button-small")}
%endif
</tbody>
</table>
@@ -137,6 +137,7 @@ class TestAdminSettingsController(TestCo
params=dict(_method='put',
username='test_admin',
new_password=new_password,
password_confirmation = new_password,
password='',
name=new_name,
lastname=new_lastname,
@@ -160,6 +161,7 @@ class TestAdminSettingsController(TestCo
_method='put',
new_password=old_password,
password_confirmation = old_password,
name=old_name,
lastname=old_lastname,
@@ -186,6 +188,7 @@ class TestAdminSettingsController(TestCo
new_password='test12',
password_confirmation = 'test122',
name='NewName',
lastname='NewLastname',
email=new_email,))
@@ -201,6 +204,7 @@ class TestAdminSettingsController(TestCo
@@ -16,12 +16,14 @@ class TestAdminUsersController(TestContr
self.log_user()
username = 'newtestuser'
password = 'test12'
password_confirmation = password
name = 'name'
lastname = 'lastname'
email = 'mail@mail.com'
response = self.app.post(url('users'), {'username':username,
'password':password,
'password_confirmation':password_confirmation,
'name':name,
'active':True,
'lastname':lastname,
@@ -90,6 +92,7 @@ class TestAdminUsersController(TestContr
'password_confirmation':password,
Status change: