We've moved discussions to Discord

Add Personal Account

Rustin Jessen
When an unregistered user accepts an invitation to an account, a personal account is not created for them.

Is there a workflow for that user to create a personal account?
Chris Oliver
You can add a line to the Invitation accept method that creates the personal account.

I wasn't sure if that should be done by default or not. Probably should be if personal accounts are enabled.

I wanted to avoid confusion if they accept an invite and are then logged into the correct account. That should be doable if we set the account_id session cookie automatically after accepting.
Rustin Jessen
Thanks Chris, this makes sense.
william hancharek
I was doing the same thing as , and thought it would be easier to just comment out the following line? https://github.com/jumpstart-pro/jumpstart-pro/blob/master/app/controllers/users/registrations_controller.rb#L16

when doing this the personal account is created for users that get invited.  
Rustin Jessen
Been experimenting with this again. Checked out the path by william hancharek and changed /app/controllers/users/registrations_controller.rb#L16 to
resource.skip_default_account = false
Now, with personal accounts turned on in config, a personal account is created for users accepting an invitation.

Now my only problem is that a personal account is not created for a user if the "Register with Account Details" setting is set to true. The form asks the user for an account name, and creates an account, but no personal account is created. 

Is there a best practice to make sure a personal account is created for ALL new users, even if they are also creating another account?
Rustin Jessen
FWIW I got it. 

Just commented out the following line

#return accounts.first if accounts.any?

in app/models/concerns/user_accounts.rb:25

Now it creates a personal account whether the user is creating a new account with details (:name, :subdomain), or accepting an invitation to an account.
Rustin Jessen
When an unregistered user accepts an invitation to an account, a personal account is not created for them.

Is there a workflow for that user to create a personal account?
Chris Oliver
You can add a line to the Invitation accept method that creates the personal account.

I wasn't sure if that should be done by default or not. Probably should be if personal accounts are enabled.

I wanted to avoid confusion if they accept an invite and are then logged into the correct account. That should be doable if we set the account_id session cookie automatically after accepting.
Rustin Jessen
Thanks Chris, this makes sense.
william hancharek
I was doing the same thing as , and thought it would be easier to just comment out the following line? https://github.com/jumpstart-pro/jumpstart-pro/blob/master/app/controllers/users/registrations_controller.rb#L16

when doing this the personal account is created for users that get invited.  
Rustin Jessen
Been experimenting with this again. Checked out the path by william hancharek and changed /app/controllers/users/registrations_controller.rb#L16 to
resource.skip_default_account = false
Now, with personal accounts turned on in config, a personal account is created for users accepting an invitation.

Now my only problem is that a personal account is not created for a user if the "Register with Account Details" setting is set to true. The form asks the user for an account name, and creates an account, but no personal account is created. 

Is there a best practice to make sure a personal account is created for ALL new users, even if they are also creating another account?
Rustin Jessen
FWIW I got it. 

Just commented out the following line

#return accounts.first if accounts.any?

in app/models/concerns/user_accounts.rb:25

Now it creates a personal account whether the user is creating a new account with details (:name, :subdomain), or accepting an invitation to an account.
Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC