【发布时间】:2015-05-03 10:01:05
【问题描述】:
我正在尝试让 ember-cli-simple-auth-devise 工作。我已经按照https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-devise 的要求对 Rails 进行了修改,但我发现 emberjs 发送了错误的属性:account[identification] 和 account[password] 而不是 user[email] 和 user[password]。
我变了
ENV['simple-auth-devise'] = {
resourceName: 'account'
};
到
ENV['simple-auth-devise'] = {
resourceName: 'user'
};
和 login.hbs 包含:
<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>
以便表单生成一个名为电子邮件的表单字段,而不是标识。在控制器中:
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 有我想要的:
{email: "email@address.com", password: "supersecret"}
但只有 Rails
{"user"=>{"password"=>"supersecret"},
"controller"=>"sessions",
"action"=>"create"}"
电子邮件丢失。如何让电子邮件到达 Rails?
【问题讨论】: