Differential / accounts-entry

Meteor sign up and sign in pages
http://github.differential.com/accounts-entry/
MIT License
305 stars 189 forks source link

Invites #236

Open SachaG opened 9 years ago

SachaG commented 9 years ago

Now that Telescope uses accounts-entry, I'm thinking about how to make it play nice with the invite system. The invite flow looks something like this:

  1. Alice has an account, Bob doesn't.
  2. Alice enters Bob's email and invites him.
  3. Bob receives an email with a link to the site.
  4. Bob signs up.

Right now we track all invited emails in an Invites collection, so step 4 can only happen if Bob uses the same email Alice entered. That's not great because it means Bob can't sign up via Twitter, Facebook, etc.

A better system would be generating a special token at step 2 and using that to invite Bob to sign up via a special URL (i.e. http://site.com/sign-up/a52s76hdia62z).

So my point is: maybe the token could be generated and handled by accounts-entry?

rgoomar commented 9 years ago

I would really like this system. It could be used in a classroom type situation. Where a teacher gives a sign up URL to students and they will then sign up using that URL and be enrolled under the class.

rgoomar commented 9 years ago

So, now thinking about it, this could be broken down into two different systems.

  1. Direct Referrals / Invites
  2. Organization Invites (More complicated)

I'm not entirely sure if organizational invites should be in this package or as a separate package in itself. Thoughts @SachaG @queso?

SachaG commented 9 years ago

What would be the difference exactly? I was thinking the package would provide a simple API to generate invite codes, and the app would be free to use them however it wants.

rgoomar commented 9 years ago

The difference I see there is that the first option gives a way to give invites to the application while the second is a way for users to invite someone to sign up and be apart of a certain group or organization. So, in the second scenario, there is possibility of adding fields. Like in the teacher example I put, it would be like this:

  1. teacher invites students to join classroom
  2. student goes through URL given by teacher
  3. student is now enrolled in the class and there is a class field that is filled in automatically while registering the user (The field could be anything)

As opposed to this scenario:

  1. User joins private website
  2. User refers friend with invite code
  3. Friend signs up
SachaG commented 9 years ago

I think for case 1 people could just add a callback to accounts_oncreateuser? I don't know, to me it seems a bit too specific a use case to be handled by the package.

rgoomar commented 9 years ago

Yeah, I agree with you. Thanks for the input. This token system could allow for people to create their own little referral / affiliate system out of it.