var ENV = {
//...
HeyookAuth: {
resourceName: "user",
serverTokenEndpoint: 'api/users/sign_in'
}
//...
};
import DS from 'ember-data';
export default DS.Model.extend({
email: DS.attr('string'),
token: DS.attr('string')
});
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
import LoginRouteMixin from 'ember-cli-heyook-auth/mixins/login-route';
export default Ember.Route.extend(ApplicationRouteMixin, LoginRouteMixin);
in route, you can do
beforeModel: ->
if @get('session.isAuthenticated')
@transitionTo "dashboard"
or
actions:
logout: ->
@get('session').invalidate()
{{login-form
onSubmit='submit'
onRemember='updateRememberMe'}}
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin);