← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12223: minor

 

------------------------------------------------------------
revno: 12223
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-24 15:21:12 +0700
message:
  minor
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java	2013-09-19 09:51:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/UnregisteredSMSListener.java	2013-09-24 08:21:12 +0000
@@ -61,6 +61,8 @@
     private SmsMessageSender smsMessageSender;
 
     private IncomingSmsService incomingSmsService;
+    
+    public static final String USER_NAME = "anonymous";
 
     @Transactional
     @Override
@@ -129,7 +131,18 @@
 
                 if ( anonymousUser == null )
                 {
-                    anonymousUser = userService.getUserCredentialsByUsername( "admin" );
+                    User user = new User();
+                    UserCredentials usercredential = new UserCredentials();
+                    usercredential.setUsername( USER_NAME );
+                    usercredential.setPassword( USER_NAME );
+                    usercredential.setUser( user );
+                    user.setSurname( USER_NAME );
+                    user.setFirstName( USER_NAME );
+                    user.setUserCredentials( usercredential );
+                    
+                    userService.addUserCredentials( usercredential );
+                    userService.addUser( user );
+                    anonymousUser = userService.getUserCredentialsByUsername( "anonymous" );
                 }
                 
                 // forward to user group by SMS, E-mail, DHIS conversation