usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [17/50] [abbrv] usergrid git commit: USERGRID-1241: fix broken tests
Date Thu, 04 Feb 2016 17:57:41 GMT
USERGRID-1241: fix broken tests


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/27b60feb
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/27b60feb
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/27b60feb

Branch: refs/heads/asf-site
Commit: 27b60febd926b60e88f314ef9056ac7ebba6367d
Parents: 5cc39fb
Author: Mike Dunker <mdunker@apigee.com>
Authored: Thu Jan 28 18:20:02 2016 -0800
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Thu Jan 28 18:20:02 2016 -0800

----------------------------------------------------------------------
 .../usergrid/rest/management/users/UserResource.java    | 12 ++++++++----
 .../management/cassandra/ManagementServiceImpl.java     | 12 +++++++++++-
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/27b60feb/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
index a968508..185559e 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
@@ -219,9 +219,11 @@ public class UserResource extends AbstractContextResource {
         try {
             this.token = token;
             TokenInfo tokenInfo = management.getPasswordResetTokenInfoForAdminUser(token);
-            organizationId = tokenInfo.getWorkflowOrgId();
+            if (tokenInfo != null) {
+                organizationId = tokenInfo.getWorkflowOrgId();
+            }
 
-            if ( management.checkPasswordResetTokenForAdminUser( user.getUuid(), tokenInfo
) ) {
+            if ( management.checkPasswordResetTokenForAdminUser( user.getUuid(), token )
) {
                 return handleViewable( "resetpw_set_form", this, organizationId );
             }
             else {
@@ -264,7 +266,9 @@ public class UserResource extends AbstractContextResource {
         try {
             this.token = token;
             TokenInfo tokenInfo = management.getPasswordResetTokenInfoForAdminUser(token);
-            organizationId = tokenInfo.getWorkflowOrgId();
+            if (tokenInfo != null) {
+                organizationId = tokenInfo.getWorkflowOrgId();
+            }
 
             //      if(user == null) {
             //        errorMsg = "Incorrect username entered";
@@ -272,7 +276,7 @@ public class UserResource extends AbstractContextResource {
             //      }
 
             if ( ( password1 != null ) || ( password2 != null ) ) {
-                if ( management.checkPasswordResetTokenForAdminUser( user.getUuid(), tokenInfo
) ) {
+                if ( management.checkPasswordResetTokenForAdminUser( user.getUuid(), token
) ) {
                     if ( ( password1 != null ) && password1.equals( password2 ) )
{
                         management.setAdminUserPassword( user.getUuid(), password1 );
                         management.revokeAccessTokenForAdminUser( user.getUuid(), token );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/27b60feb/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index cc5fc9c..c65c608 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -2198,7 +2198,14 @@ public class ManagementServiceImpl implements ManagementService {
 
     @Override
     public TokenInfo getPasswordResetTokenInfoForAdminUser( String token ) throws Exception
{
-        return getTokenInfoFromAccessToken(token, TOKEN_TYPE_PASSWORD_RESET, ADMIN_USER);
+        TokenInfo tokenInfo = null;
+        try {
+            tokenInfo = getTokenInfoFromAccessToken(token, TOKEN_TYPE_PASSWORD_RESET, ADMIN_USER);
+        }
+        catch (Exception e) {
+            // intentionally empty
+        }
+        return tokenInfo;
     }
 
 
@@ -2210,6 +2217,9 @@ public class ManagementServiceImpl implements ManagementService {
 
     @Override
     public boolean checkPasswordResetTokenForAdminUser( UUID userId, TokenInfo tokenInfo
) throws Exception {
+        if (tokenInfo == null) {
+            return false;
+        }
         AuthPrincipalInfo principal = null;
         try {
             principal = tokenInfo.getPrincipal();


Mime
View raw message