dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33562
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17149: Account invite, fixed bug. Validating that invite are not sent for username that already exists.
------------------------------------------------------------
revno: 17149
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-10-17 11:29:57 +0200
message:
Account invite, fixed bug. Validating that invite are not sent for username that already exists.
modified:
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/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/javascript/user.js
--
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-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 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserAction.java 2014-10-17 09:29:57 +0000
@@ -75,13 +75,20 @@
{
this.username = username;
}
-
+
private String openId;
public void setOpenId( String openId )
{
this.openId = openId;
}
+
+ private String inviteUsername;
+
+ public void setInviteUsername( String inviteUsername )
+ {
+ this.inviteUsername = inviteUsername;
+ }
// -------------------------------------------------------------------------
// Output
@@ -126,6 +133,18 @@
}
}
+ if ( inviteUsername != null )
+ {
+ UserCredentials match = userService.getUserCredentialsByUsername( inviteUsername );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "username_in_use" );
+
+ return ERROR;
+ }
+ }
+
message = i18n.getString( "everything_is_ok" );
return SUCCESS;
=== 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 2014-09-12 06:24:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2014-10-17 09:29:57 +0000
@@ -24,6 +24,7 @@
checkValueIsExist("username", "validateUser.action");
checkValueIsExist("openId", "validateUser.action");
+ checkValueIsExist("inviteUsername", "validateUser.action");
ouwtSelected = selection.getSelected();
selection.setMultipleSelectionAllowed( true );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2014-06-13 08:08:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2014-10-17 09:29:57 +0000
@@ -92,7 +92,6 @@
$('#retypePassword').val( saved["retypePassword"] );
$('#surname').val( saved["surname"] );
$('#firstName').val( saved["firstName"] );
- $('#phoneNumber').val( saved["phoneNumber"] );
$('#email').val( $('#inviteEmail').val() );
$('#inviteEmail').val( 'validEmail@xxxxxxxxxx' );
@@ -108,7 +107,6 @@
saved["retypePassword"] = $('#retypePassword').val();
saved["surname"] = $('#surname').val();
saved["firstName"] = $('#firstName').val();
- saved["phoneNumber"] = $('#phoneNumber').val();
$('#inviteUsername').val( $('#username').val() );
$('#username').val( 'nonExistingUserName_RpuECtIlVoRKTpYmEkYrAHmPtX4m1U' );
@@ -116,7 +114,6 @@
$('#retypePassword').val( 'validPassword_123' );
$('#surname').val( 'validSurname' );
$('#firstName').val( 'validFirstName' );
- $('#phoneNumber').val( '5555555555' );
$('#inviteEmail').val( $('#email').val() );
$('#email').val( '' );
}