From 857eaf038ea836229d9cb2bf0e6f15ee553332a0 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 24 Jul 2020 17:07:18 +0200 Subject: [PATCH] if the invite exist temp passwd has to be the same of the prev. invite --- .../org/gcube/portal/invites/InvitesManager.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/portal/invites/InvitesManager.java b/src/main/java/org/gcube/portal/invites/InvitesManager.java index 923132e..b663fbc 100644 --- a/src/main/java/org/gcube/portal/invites/InvitesManager.java +++ b/src/main/java/org/gcube/portal/invites/InvitesManager.java @@ -18,6 +18,8 @@ import org.gcube.portal.databook.server.DatabookStore; import org.gcube.portal.databook.shared.Invite; import org.gcube.portal.databook.shared.InviteOperationResult; import org.gcube.portal.databook.shared.InviteStatus; +import org.gcube.portal.databook.shared.ex.InviteIDNotFoundException; +import org.gcube.portal.databook.shared.ex.InviteStatusNotFoundException; import org.gcube.portal.mailing.message.EmailAddress; import org.gcube.portal.mailing.message.Recipient; import org.gcube.portal.mailing.message.RecipientType; @@ -101,7 +103,11 @@ public class InvitesManager { String vreName = PortalContext.getConfiguration().getCurrentGroupName(request); result = store.saveInvite(invite); if (result == InviteOperationResult.ALREADY_INVITED) { - invite.setKey(store.isExistingInvite(currScope, email)); + //if the invite existed already the id and temp passwd has to be the same of the original invite (in the persistence) + String inviteid = store.isExistingInvite(currScope, email); + invite.setKey(inviteid); + String tempPwd = store.readInvite(inviteid).getControlCode(); + invite.setControlCode(tempPwd);; } emailResult = sendInviteEmail(request, invite, currUser, vreName, name, email, vreDescription, accountExists); @@ -111,8 +117,11 @@ public class InvitesManager { _log.error("Email not valid " + e.getMessage()); e.printStackTrace(); return InviteOperationResult.FAILED; - } - + } catch (Exception e) { + _log.error("Something wrong happened retrieving the invite which seemd to be existing already " + e.getMessage()); + e.printStackTrace(); + return InviteOperationResult.FAILED; + } return (emailResult) ? result : InviteOperationResult.FAILED; }