Reputation: 7318
I have a unique user creation flow which is as follows:
So, how would I accomplish this with Meteor Accounts and the User model?
In a nutshell:
Upvotes: 7
Views: 2841
Reputation: 3073
onCreateUser
to add an "anonymous" field ({anonymous:1}
)
when a random password is used, maybe generated with Meteor.uuid()
.{created:new Date()}
) to clean out old, anonymous accounts.Meteor.autorun(function()
{Meteor.users.find({anonymous:1,$where:"new Date() - this.created >
360000"}).forEach(function (user) {
Meteor.users.remove({_id:user._id})}});
$set:{anonymous:0}
Don't use localStorage, and don't use UIDs. The session cookie IS your UID.
Upvotes: 8
Reputation: 1404
I don't know how to help with the authentication, but as for creating a blank User object, I've successfully done the following on the server-side (with a different name...):
Meteor.users.insert({profile: {name: 'Oompa Loompa'}, foo: 'bar'});
Upvotes: 1