简体   繁体   中英

Meteor: Custom sign up process using Autoform

I've been trying (and ~succeeding) to use Autoform to create a custom registration process for my users.

I am using Collection2 along with it and have created a RegistrationSchema for my Autoform fields and handle validation.

The process is as follow : - Use autoform with a meteor method and the custom schema - In the meteor method use Account.createUser

The issue here is that when using Account.createUser server side (because we are in a meteor method) it does not log the user in. What I did there is to pass to user email and password to the meteor method's callback, running on the client side (see the files server - methods.js and client - sign-up.js in the gist) and then perform the login.

https://gist.github.com/gabriel-dehan/3f78d94f6a035c89595d

It works fine but seems really really not secure, passing the user credentials around like this.

Is this problematic ? If so, how could I fix that ? I see two options : - Do a server side login but I have no clue how to. - Transfer the Account.createUser logic onto the client, but as autoform calls the server side Meteor.method I don't know how to tell him to call a client method.

Any takes on this issue ? It would be great !

Thanks.

I don't believe server side login is possible, unless there was a way to hand back the login token through the meteor method and then call login in the callback.

If your using simpleschema just for the validation aspect, I would use a client side validator such as mesosphere https://atmospherejs.com/copleykj/mesosphere and throw out autoform for the login, since you only need three inputs.

Found this...

It might help you with what you are working on.

https://github.com/aldeed/meteor-autoform/issues/200

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM