× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Login after successful signup Ember-Simple-Auth

Marco Otte-Witte
Mar 07, 2015
<p>The best solution would probably to just reuse the username and password properties you already have in the registration controller:</p> <pre><code>export default Ember.ObjectController.extend({ firstname: '', lastname: '', username: '', password: '', actions: { registerUser: function(){ var self = this; var user = this.store.createRecord('user', { first_name: this.get('firstname'), last_name: this.get('lastname'), username: this.get('username') }); user.set('typedPass', this.get('password')); user.save().then(function() { //this is basically what happens when you trigger the LoginControllerMixin's "authenticate" action this.get('session').authenticate('app:authenticators:custom', { identification: this.get('username'), password: this.get('password') }); }); } } </code></pre> <p>});</p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/22774111/Login%20after%20successful%20signup%20Ember-Simple-Auth/22782334">Stack Overflow</a>.</p>
comments powered by Disqus