0
votes

I'm trying to get ember-cli-simple-auth-devise to work. I already did the modifications to Rails as requested by https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-devise but I found the emberjs was sending the wrong attributes: account[identification] and account[password] instead of user[email] and user[password].

I changed

ENV['simple-auth-devise'] = {
  resourceName: 'account'
};

to

ENV['simple-auth-devise'] = {
  resourceName: 'user'
};

and login.hbs to contain:

<form {{action 'authenticate' on='submit'}}>
    <label for="email">Email</label>
    {{input value=email placeholder='Email'}}
    <label for="password">Password</label>
    {{input value=password placeholder='Password' type='password'}}
    <button type="submit">Login</button>
</form>

so that the form generates a form field called email instead of identification. In the controller:

export default Ember.Controller.extend({
    actions: {
        authenticate: function() {
            var data = this.getProperties('email', 'password');
            return this.get('session').authenticate('simple-auth-authenticator:devise', data);
        }
    }
});

data has what I want:

{email: "[email protected]", password: "supersecret"}

but Rails only

{"user"=>{"password"=>"supersecret"},
 "controller"=>"sessions",
 "action"=>"create"}"

The email is missing. How do I make the email reach Rails?

1

1 Answers

0
votes

The identification form field should be left as identification as it'll be converted to email automatically when calling devise. The conversion of name happens according to the identificationAttributeName configuration.