1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

Improved secure mode viewing

Co-Authored-By: McMatts <matt@documize.com>
This commit is contained in:
Harvey Kandola 2018-10-05 17:42:06 +01:00
parent ab2cbd4ff7
commit df0e3c108e
3 changed files with 5 additions and 10 deletions

View file

@ -73,6 +73,8 @@ export default Service.extend({
return resolve(this);
}
requestedRoute = requestedRoute.toLowerCase().trim();
return this.get('ajax').request('public/meta').then((response) => {
this.setProperties(response);
this.set('version', 'v' + this.get('version'));
@ -86,6 +88,7 @@ export default Service.extend({
});
this.get('localStorage').clearAll();
return resolve(this);
} else if (is.not.include(requestedUrl, '/auth/')) {
this.get('localStorage').storeSessionItem('entryUrl', requestedUrl);
}

View file

@ -143,7 +143,6 @@ export default Service.extend({
// Run tenant level backup.
backup(spec) {
return new EmberPromise((resolve) => {
let url = this.get('appMeta.endpoint');
let token = this.get('sessionService.session.content.authenticated.token');
@ -177,12 +176,5 @@ export default Service.extend({
xhr.send(JSON.stringify(spec));
});
// return this.get('ajax').raw(`global/backup`, {
// method: 'post',
// data: JSON.stringify(spec),
// contentType: 'json',
// dataType: 'text'
// });
}
});

View file

@ -35,7 +35,7 @@ export default SimpleAuthSession.extend({
}),
user: computed('isAuthenticated', 'session.content.authenticated.user', function () {
if (this.get('isAuthenticated')) {
if (this.get('isAuthenticated') && !this.get('appMeta.secureMode')) {
let user = this.get('session.content.authenticated.user') || { id: '0' };
let data = this.get('store').normalize('user', user);
let um = this.get('store').push(data)
@ -45,7 +45,7 @@ export default SimpleAuthSession.extend({
}),
authenticated: computed('session.content.authenticated.user', function () {
if (is.null(this.get('session.authenticator'))) return false;
if (is.null(this.get('session.authenticator')) || this.get('appMeta.secureMode')) return false;
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
}),