Can log in now
This commit is contained in:
parent
1aa8d8d88d
commit
c2e8299e67
4 changed files with 17 additions and 6 deletions
|
@ -1,21 +1,21 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
|
||||
loading: false,
|
||||
|
||||
actions: {
|
||||
authenticate: function() {
|
||||
let credentials = this.getProperties('identification', 'password');
|
||||
let session = this.get('session');
|
||||
let authenticator = 'simple-auth-authenticator:jwt';
|
||||
|
||||
// Manually clean up because there might not be a transition
|
||||
this.get('flashMessages').clearMessages();
|
||||
this.set('loading', true).then(session.authenticate(authenticator, credentials).catch((error) => {
|
||||
let { identification, password } = this.getProperties('identification', 'password');
|
||||
this.set('loading', true)
|
||||
this.get('session').authenticate('authenticator:oauth2', identification, password).catch((error) => {
|
||||
this.transitionToRoute('login');
|
||||
this.set('loading', false);
|
||||
this.get('flashMessages').error(error.error);
|
||||
}));
|
||||
});
|
||||
this.set('loading', false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
|
||||
|
|
Reference in a new issue