← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16810: Minor

 

------------------------------------------------------------
revno: 16810
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-09-25 09:29:20 +0200
message:
  Minor
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/SecurityService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.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/security/DefaultSecurityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2014-09-24 09:23:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java	2014-09-25 07:29:20 +0000
@@ -248,7 +248,7 @@
     public boolean restore( UserCredentials credentials, String token, String code, String newPassword, RestoreType restoreType )
     {
         if ( credentials == null || token == null || code == null || newPassword == null
-            || !canRestoreNow( credentials, token, code, restoreType ) )
+            || !canRestore( credentials, token, code, restoreType ) )
         {
             return false;
         }
@@ -268,15 +268,15 @@
         return true;
     }
 
-    public boolean canRestoreNow( UserCredentials credentials, String token, String code, RestoreType restoreType )
+    public boolean canRestore( UserCredentials credentials, String token, String code, RestoreType restoreType )
     {
-        String logInfoPrefix = "Restore User " + credentials.getUid() + " " + credentials.getUsername();
+        String logPrefix = "Restore user: " + credentials.getUid() + ", username: " + credentials.getUsername();
 
         String errorMessage = verifyToken( credentials, token, restoreType );
 
         if ( errorMessage != null )
         {
-            log.info( logInfoPrefix + " verifyToken() failed: " + errorMessage );
+            log.info( logPrefix + " verifyToken() failed: " + errorMessage );
             return false;
         }
 
@@ -291,11 +291,11 @@
 
         if ( errorMessage != null )
         {
-            log.info( logInfoPrefix + " canRestore() failed: " + errorMessage + "." );
+            log.info( logPrefix + " canRestore() failed: " + errorMessage );
             return false;
         }
 
-        log.info( logInfoPrefix + " success." );
+        log.info( logPrefix + " success" );
         return true;
     }
 
@@ -307,11 +307,11 @@
      * <ul>
      *     <li>credentials_parameter_is_null</li>
      *     <li>token_parameter_is_null</li>
-     *     <li>restoreType_parameter_is_null</li>
+     *     <li>restore_type_parameter_is_null</li>
      *     <li>cannnot_parse_restore_options ...</li>
      *     <li>wrong_prefix_for_restore_type ...</li>
      *     <li>could_not_verify_token ...</li>
-     *     <li>restoreToken_does_not_match_supplied_token</li>
+     *     <li>restore_token_does_not_match_supplied_token</li>
      * </ul>
      *
      * @param credentials the user credentials.
@@ -333,7 +333,7 @@
 
         if ( restoreType == null )
         {
-            return "restoreType_parameter_is_null";
+            return "restore_type_parameter_is_null";
         }
 
         RestoreOptions restoreOptions = RestoreOptions.getRestoreOptions( token );
@@ -357,10 +357,10 @@
 
         if ( !credentials.getRestoreToken().equals( encodedToken ) )
         {
-            return "restoreToken_does_not_match_supplied_token " + token;
+            return "restore_token_does_not_match_supplied_token " + token;
         }
 
-        return null; // Success.
+        return null;
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/SecurityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/SecurityService.java	2014-09-24 06:56:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/SecurityService.java	2014-09-25 07:29:20 +0000
@@ -111,7 +111,7 @@
      * @param restoreType type of restore operation (e.g. pw recovery, invite).
      * @return true or false.
      */
-    boolean canRestoreNow( UserCredentials credentials, String token, String code, RestoreType restoreType );
+    boolean canRestore( UserCredentials credentials, String token, String code, RestoreType restoreType );
 
     /**
      * Tests whether the given token in combination with the given user name is

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java	2014-09-17 07:03:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AccountController.java	2014-09-25 07:29:20 +0000
@@ -232,7 +232,7 @@
                 return;
             }
 
-            boolean canRestore = securityService.canRestoreNow( credentials, inviteToken, inviteCode, RestoreType.INVITE );
+            boolean canRestore = securityService.canRestore( credentials, inviteToken, inviteCode, RestoreType.INVITE );
 
             if ( !canRestore )
             {