0

How would I go about sending the data for user signup to the backend server?

I know of the way to use ember models to post the data to the backend but that would store the password and password_confirmation in plain text and that sounds likes a security risk waiting to happen.

Currently using a Rails 5 backend that accepts three fields email, password, and password_confirmation. I know I need to send the data in a POST request but I'm not sure how to do that.

If anyone could tell me the proper way of doing this or pointing me to some hidden article I couldn't find that'd be great.

Matt Browning
  • 25
  • 1
  • 8

3 Answers3

0

If you want to get fancy, you can do something like this.
However, generally one would just use https. (Here's an explanation of how http works to secure data transferred between client and server.) In order to do so, you will need to generate and install an SSL certificate on your server. It is possible to get reputable certs for free. I use Let's Encrypt. The details of the implementation depend on your specific setup - there are plenty of good guides out there if you do a little googling.

danyamachine
  • 1,848
  • 1
  • 18
  • 21
  • All of the data would be sent using https, just curious how I would implement sending it to the backend server on the Emberjs side of things. – Matt Browning Apr 10 '17 at 04:35
0

Generally folks use either a plain Ajax POST for this or ember-simple-auth (which handles the Ajax POST for you).

Because you are right, storing that using data in the Ember Data store doesn't sound good

acorncom
  • 5,975
  • 1
  • 19
  • 31
  • Do you happen to know an example of using an ajax request in Ember? Not sure how to get the form data out of the form without using Ember-Data. – Matt Browning Apr 10 '17 at 23:31
0

From what I understood from the comment given to the answer provided by acorncom; what you basically need is making a simple ajax request with Ember. You can retrieve jquery from Ember with Ember.$; hence you can make use of jquery's ajax function.

I have also provided a simple twiddle for you that makes a dummy post to a fake server which responds. You can see how I used Ember.$.ajax within application.js action handler postData that is triggered upon button click. Hope this helps.

feanor07
  • 3,328
  • 15
  • 27