We've moved discussions to Discord

Invite user to account, skip the account creation on sign up

Andrew Quinn
Has anyone configured jumpstart to create an account on registration (as per Chris Oliver 's video) but changed the invites to add people to that account rather than create a new one?

In my app there are no personal accounts, and the team admin/owner should be be able to invite other users (not yet registered) to their account. I'm trying to figure out the best way to pass the account along with the invitation in order to skip the account creation. The invite auto redirects to the signup screen, so the account would need to passed to that as well.
Andrew Hodson
I'm pretty sure no "User" record is created when inviting a user to an account. The invite form creates a record under the account_invitations.

I'm guessing you could edit the form to import the data from this table.
Andrew Quinn
You're correct, the user isn't created on invitation. However the invitation link redirects to the sign_up form. The sign up form doesn't have access to the account. You'd need to pass the account from the invitation to the sign_up form, and then have a conditional on the from to show the account field and modify the controller to accept the existing account.
Andrew Hodson
in the account_invitations_controller.rb. I think this where it does that 

before_action :authenticate_user_with_sign_up!


Rod Klingler
I got around this by having the invited user sign up, and then showing them their invitation on their dashboard, with the link to accept or decline. May not work for everyone, but it worked for me.
Andrew Hodson
what happens if they decline?
Rod Klingler
They have their own personal account, then, and they can choose to add a subscription if they want to access the stuff on the site.
Andrew Hodson
Nice!
Rod Klingler
I just figured people who are completely uninterested wouldn't bother to decline, they would ignore the invite email.
Andrew Hodson
I agree. I was just wondering if you used the personal account to default to 
Chris Oliver
Just released an update to this so that you can enable a checkbox in the Jumpstart admin to add the Account fields in the sign up form, and those are hidden upon accepting an invitation.
Ben Kraus
Chris Oliver Just pulled in the latest related changes, and I'm now getting an error when trying to view the config as an admin (screenshot below). Is there something else I need to do here to migrate?

CleanShot 2020-05-30 at 10.50.11@2x.png 195 KB
Chris Oliver
Ben Kraus  Did you restart your server?
Ben Kraus
Yup, I did. Just got it working - had to add `register_with_account: true/false` to the `jumpstart.yml` file
Chris Oliver
I have confirmed it works with or without the line in the yml file, so this isn't a bug in the code.

It could have been Spring caching things (as usual *shakes fist*).
Ben Kraus
Hm, maybe I hadn't, I dunno, been trying lots of things :) It's all good now though! Thanks!
Matt Bjornson
Hey  Rod Klingler  that's a great addition, I was planning on building that ( showing the invite on their dashboard) for existing users being invited to a new group/team!
Notifications
You’re not receiving notifications from this thread.