I have a simple form that captures data from the user. It is just a single field and a date stamp for tracking weight on a daily basis.
I am using the Meteor authorisation package. When a user is logged in I just save UserID into the list and then filter the collection for that User ID.
This is fine if I force users to login before they use the system.
But I would like to allow users to try the system first. So they might save 3 or 4 lines of data and then decide to create an account and save. In the short term I would like to just save the data from that current session (so if they shut their browser down without having saved, their data is lost). In Phase 2 I would like the data to persist so that if they don't save but come back the next day in the same browser they can still decide to save their data against a permanent account.
I am currently thinking of saving the uuid instead of the standard Meteor.userId for temporary users and then just replace this value with their new Meteor.UseriD. Longer term saving a random number as the user ID and saving this data to a persistent client cache and then overwriting with their Meteor.UserID when they create an account.
But I am a newbie and would like to know if there is a more elegant way of achieving these two goals:
1) Allowing the user to record some data, that only they can see. Then saving this when they choose to create an account. 2) Allowing the user to record some data, that persists across sessions. Then saving that data when they choose to create an account.
`accounts-base` This package is the core of Meteor's developer-facing user accounts functionality.
// Asynchronous call Meteor. call('foo', 1, 2, (error, result) => { ... }); If you do not pass a callback on the server, the method invocation will block until the method is complete. It will eventually return the return value of the method, or it will throw an exception if the method threw an exception.
Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node. js and general JavaScript community.
If you are using the meteorite package manager you can use the accounts-anonymous plugin https://github.com/tmeasday/meteor-accounts-anonymous
It is only two small files so you could also just added directly to your project.
And then once logged in transefer the user info over.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With