dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04115
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1361: Improved server side validation for add/update users
------------------------------------------------------------
revno: 1361
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-01-28 16:47:24 +0100
message:
Improved server side validation for add/update users
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2009-03-24 14:27:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2010-01-28 15:47:24 +0000
@@ -83,4 +83,15 @@
{
return new UrlValidator().isValid( url );
}
+
+ /**
+ * Validates whether a password is valid.
+ *
+ * @param password the password.
+ * @return true if the password is valid, false otherwise.
+ */
+ public static boolean passwordIsValid( String password )
+ {
+ return password != null && password.length() >= 5 && password.length() < 50;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserAction.java 2010-01-28 15:47:24 +0000
@@ -173,7 +173,11 @@
message = i18n.getString( "specify_retype_password" );
return INPUT;
-
+ }
+
+ if ( id == null && ( !ValidationUtils.passwordIsValid( rawPassword ) ) )
+ {
+ message = i18n.getString( "password_is_not_valid" );
}
if ( rawPassword != null && rawPassword.trim().length() != 0 && !rawPassword.equals( retypePassword ) )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2010-01-28 15:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2010-01-28 15:47:24 +0000
@@ -189,6 +189,7 @@
filter_by_role_name = Filter by rolename
phone_number = Phone number
email_is_not_valid = E-mail is not valid
+password_is_not_valid = Password is not valid
select_all_in_group = Select all in group
remove_all_in_group = Remove all in group
organisation_units = Organisation units
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2010-01-24 23:52:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2010-01-28 15:47:24 +0000
@@ -50,13 +50,13 @@
</tr>
<tr>
<td><label for="surname">$i18n.getString( "surname" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="surname" name="surname" style="width:20em" class="{validate:{required:true,minlength:4,maxlength:25}}"></td>
+ <td><input type="text" id="surname" name="surname" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:25}}"></td>
<td></td>
<td></td>
</tr>
<tr>
<td><label for="firstName">$i18n.getString( "firstName" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="firstName" name="firstName" style="width:20em" class="{validate:{required:true,minlength:4,maxlength:25}}"></td>
+ <td><input type="text" id="firstName" name="firstName" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:25}}"></td>
<td></td>
<td></td>
</tr>