parent
8897e35398
commit
75b75358cd
16 changed files with 200 additions and 34 deletions
21
app/controllers/login.js
Normal file
21
app/controllers/login.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Controller, inject: { service } } = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
session: service(),
|
||||
flashMessages: service(),
|
||||
|
||||
actions: {
|
||||
authenticate() {
|
||||
this.transitionToRoute('loading').then(() => {
|
||||
let { identification, password } = this.getProperties('identification', 'password');
|
||||
this.get('session').authenticate('authenticator:application', identification, password).catch((reason) => {
|
||||
this.transitionToRoute('login').then(() => {
|
||||
this.get('flashMessages').danger(reason.non_field_errors || reason);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue