add Account to signup but only when not an Invite?

John Quarto-vonTivadar
I noticed there's a setting as to whether the signup form should have a field for Account (or not). This works fine for my regular signups, but once they start issuing Invites to co-workers to join them, the coworker also sees an Account field in Sign up and end up writing in their common Company name, not realizing it's not of any use

Has anyone set something up along the lines of leaving Account field out of the signup form when it's being used in the context of an Invitation?
John Quarto-vonTivadar
or alternately, two different signup forms? how did you handle the routing?
Donn Felker
When I invite it does not have the account in the sign up form. Does the url have a invite in the query params? Here's what mine looks like:


However, if I go to the regular sign up page on the same url, without an invite, I get this:

If it's truly invite-only, you can hide the signup buttons, or check in the registrations_controller and modify some stuff in there (I think that's where you'd want to do it). The skip_default_account is what prevents the account field from showing up in the registration form. 
John Quarto-vonTivadar
hmm, I'm not sure that's where my problem is.  I see the same forms as you described, and when the invitee fills it out, get his email, and then comes back and logs in, I see this:
Screen Shot 2021-05-25 at 12.00.15 AM.png 170 KB

where the PeteGrif Account has issued him the invite, and then auto-magically, there is also a Paul Ryan account created for him (i guess it's a personal account? But why? what purpose does it serve?  In my app's use-case, if an Account owner invite 3-4-5 different people to share his account, it generates that many additional Accounts, none of which will ever be used for anything.

I think this comes from views/devise/registrations/new.html.erb where there's some conditional code to add the form element for the account name, so I wrapped a `unless` around it to try and bypass it.  No effect :(
Screen Shot 2021-05-25 at 12.09.25 AM.png 305 KB
John Quarto-vonTivadar
Anyone else reading this at this late date:

There's likely a conceptual hurdle you're facing:  It is the expected behavior that an account will be create for each person who registers, above and beyond if they were registering due to an invite to share someone else's account.  Setting the JSP setting of Personal accounts to false does not inhibit the creation an account for that person, only that what Account it does create does not get flagged as personal as the boolean attribute in the Account model. 

The solution, when you only want someone who only ever signs up after an invite to someone else's account is to make use of the impersonal_accounts scope.  Whew. 
You’re not receiving notifications from this thread.
© 2022 GoRails, LLC