datawire / datawire-cli

Datawire Cloud tools and utilities
1 stars 0 forks source link

Regenerate invitation code for invited users who haven't signed up yet #38

Open janicedatawire opened 8 years ago

janicedatawire commented 8 years ago

Currently we have no mechanism for regenerating the invitation code for a user who has been invited to join an org but hasn't yet followed up and joined it. As no emails are sent, this code is a transient thing displayed to the inviter once at the time of the original invitation and then is not retrievable again. If someone tries to invite the user again (using the same email address) it fails, saying the user already exists:

$ dwc -vvv invite-user ed@beathean.com 
missing public key: key not present: keys/dwc-identity.key
NOT VERIFYING TOKENS!
Setting up to use Cloud Registrar at https://identity.datawire.io
Inviting ed@beathean.com to LSLYJQ8228...
Success! Send them:

dwc accept-invitation 'S4D61069BLW1KN1GYMEUM0FPA47A8MEXN10UZMKD'

$ dwc -v invite-user ed@beathean.com
NOT VERIFYING TOKENS!
Setting up to use Cloud Registrar at https://identity.datawire.io
Inviting ed@beathean.com to LSLYJQ8228...
failure: The user already exists.

One possible solution is to return the same invitation code in response to requests for invitations until such time as the code is used and the user switches to an active user rather than just an invited user.

If we can't send the same code, a new code with a message along the lines of the following might work as well:

Success! Send them:

dwc accept-invitation 'LW1KN1GYMEUM0FPA47A8MES4D61069BXN10UZMKD'

This user was previously invited to your organization using a different code which is now invalid.
janicedatawire commented 8 years ago

More reason to implement this: I just had something go wrong on an invite-user request (got a 504 response) but the request had already been processed in the identity service and thus could not be repeated.