I'm using the basic configuration of ember-simple-auth. When I click submit, request is gone to backend but my password field becomes empty. My username field is still filled.
My template: login.emblem
form.submit='authenticate'
Ember.TextField id='identification' valueBinding='identification'
Ember.TextField id='password' type='password' valueBinding='password'
button type='submit'
| Login
Controller: login.js
import Ember from "ember";
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
export default Ember.Controller.extend(LoginControllerMixin, {
authenticator: "simple-auth-authenticator:oauth2-password-grant",
});
Route: login.js
import Ember from "ember";
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
});
Instead of using LoginControllerMixin
's authenticate
action you can simply define your own:
import Ember from 'ember';
import AuthenticationControllerMixin from 'simple-auth/Authentication-controller-mixin';
export default Ember.Controller.extend(AuthenticationControllerMixin, {
authenticator: 'simple-auth-authenticator:oauth2-password-grant',
actions: {
authenticate: function() {
var data = this.getProperties('identification', 'password');
return this._super(data);
}
}
});