Browse Source

if the invite exist temp passwd has to be the same of the prev. invite

master
Massimiliano Assante 2 years ago
parent
commit
857eaf038e
  1. 15
      src/main/java/org/gcube/portal/invites/InvitesManager.java

15
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;
}

Loading…
Cancel
Save