parent
596c0f78d0
commit
6277c3da09
|
@ -7,18 +7,15 @@ import UserError from 'core/lib/user-error';
|
||||||
* @property {Boolean} loggedIn Whether the user is currently logged
|
* @property {Boolean} loggedIn Whether the user is currently logged
|
||||||
*/
|
*/
|
||||||
export default class Auth {
|
export default class Auth {
|
||||||
constructor($http, $q, vnApp, $translate, $state, $transitions, $window, vnToken, vnModules, aclService) {
|
constructor($http, $q, $state, $transitions, $window, vnToken, vnModules) {
|
||||||
Object.assign(this, {
|
Object.assign(this, {
|
||||||
$http,
|
$http,
|
||||||
$q,
|
$q,
|
||||||
vnApp,
|
|
||||||
$translate,
|
|
||||||
$state,
|
$state,
|
||||||
$transitions,
|
$transitions,
|
||||||
$window,
|
$window,
|
||||||
vnToken,
|
vnToken,
|
||||||
vnModules,
|
vnModules,
|
||||||
aclService,
|
|
||||||
loggedIn: false
|
loggedIn: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -111,13 +108,11 @@ export default class Auth {
|
||||||
headers: {Authorization: json.data.token}
|
headers: {Authorization: json.data.token}
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.vnToken.set(json.data.token, data.multimediaToken.id, now, json.data.ttl, remember);
|
this.vnToken.set(json.data.token, data.multimediaToken.id, now, json.data.ttl, remember);
|
||||||
this.loadAcls().then(() => {
|
|
||||||
let continueHash = this.$state.params.continue;
|
let continueHash = this.$state.params.continue;
|
||||||
if (continueHash)
|
if (continueHash)
|
||||||
this.$window.location = continueHash;
|
this.$window.location = continueHash;
|
||||||
else
|
else
|
||||||
this.$state.go('home');
|
this.$state.go('home');
|
||||||
});
|
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +126,7 @@ export default class Auth {
|
||||||
this.vnToken.unset();
|
this.vnToken.unset();
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
this.vnModules.reset();
|
this.vnModules.reset();
|
||||||
this.aclService.reset();
|
this.vnModules.aclService.reset();
|
||||||
this.$state.go('login');
|
this.$state.go('login');
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
|
|
Loading…
Reference in New Issue