Upgrading authentication libs
This commit is contained in:
parent
878e8d1b60
commit
459bd7d6be
7 changed files with 36 additions and 30 deletions
|
@ -4,6 +4,9 @@ import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';
|
|||
|
||||
export default Ember.Route.extend(ApplicationRouteMixin, {
|
||||
actions: {
|
||||
invalidateSession: function() {
|
||||
this.get('session').invalidate();
|
||||
},
|
||||
loading: function() {
|
||||
NProgress.start();
|
||||
this.router.one('didTransition', function() {
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
import Ember from 'ember';
|
||||
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
|
||||
|
||||
export default Ember.Controller.extend(LoginControllerMixin, {
|
||||
authenticator: 'simple-auth-authenticator:jwt',
|
||||
loading: false,
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
authenticate: function() {
|
||||
this.set('errorMessage', null);
|
||||
var _this = this;
|
||||
let credentials = this.getProperties('identification', 'password');
|
||||
let authenticator = 'simple-auth-authenticator:token';
|
||||
|
||||
this.set('loading', true);
|
||||
this._super().then(function() {
|
||||
_this.set('loading', false);
|
||||
}, function(error) {
|
||||
_this.set('loading', false);
|
||||
var message = error.error;
|
||||
_this.set('errorMessage', message);
|
||||
this.get('session').authenticate(authenticator, credentials).then(()=>{
|
||||
this.set('loading', false);
|
||||
}, (error)=> {
|
||||
this.set('loading', false);
|
||||
this.set('errorMessage', error.error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
|
||||
setupController: function(controller) {
|
||||
controller.set('errorMessage', null);
|
||||
}
|
||||
|
|
Reference in a new issue