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

anon redirect before/after login

This commit is contained in:
Harvey Kandola 2017-05-03 11:37:39 +01:00
parent f8e091db53
commit f48740ec12
7 changed files with 27 additions and 10 deletions

View file

@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li
## Latest version ## Latest version
v1.46.1 v1.46.2
## OS Support ## OS Support

View file

@ -51,6 +51,7 @@ export default Ember.Component.extend({
saveLicense() { saveLicense() {
this.get('saveLicense')().then(() => { this.get('saveLicense')().then(() => {
window.location.reload();
}); });
} }
} }

View file

@ -22,14 +22,15 @@ export default Ember.Route.extend(ApplicationRouteMixin, TooltipMixin, {
appMeta: service(), appMeta: service(),
session: service(), session: service(),
pinned: service(), pinned: service(),
localStorage: service(),
beforeModel(transition) { beforeModel(transition) {
this._super(...arguments); this._super(...arguments);
return this.get('appMeta').boot(transition.targetName).then(data => { let sa = this.get('session.session.authenticator');
if (this.get('session.session.authenticator') !== "authenticator:documize" &&
this.get('session.session.authenticator') !== "authenticator:keycloak" && return this.get('appMeta').boot(transition.targetName, window.location.href).then(data => {
data.allowAnonymousAccess) { if (sa !== "authenticator:documize" && sa !== "authenticator:keycloak" && data.allowAnonymousAccess) {
return this.get('session').authenticate('authenticator:anonymous', data); return this.get('session').authenticate('authenticator:anonymous', data);
} }
@ -37,6 +38,17 @@ export default Ember.Route.extend(ApplicationRouteMixin, TooltipMixin, {
}); });
}, },
sessionAuthenticated() {
let next = this.get('localStorage').getSessionItem('entryUrl');
if (is.not.null(next) && is.not.undefined(next)) {
this.get('localStorage').clearSessionItem('entryUrl')
if (is.not.include(next, '/auth/')) {
window.location.href= next;
}
}
},
actions: { actions: {
willTransition: function( /*transition*/ ) { willTransition: function( /*transition*/ ) {
Mousetrap.reset(); Mousetrap.reset();

View file

@ -44,7 +44,7 @@ export default Ember.Service.extend({
return [this.get('endpoint'), endpoint].join('/'); return [this.get('endpoint'), endpoint].join('/');
}, },
boot(requestedUrl) { // eslint-disable-line no-unused-vars boot(requestedRoute, requestedUrl) { // eslint-disable-line no-unused-vars
let dbhash; let dbhash;
if (is.not.null(document.head.querySelector("[property=dbhash]"))) { if (is.not.null(document.head.querySelector("[property=dbhash]"))) {
dbhash = document.head.querySelector("[property=dbhash]").content; dbhash = document.head.querySelector("[property=dbhash]").content;
@ -63,7 +63,7 @@ export default Ember.Service.extend({
return resolve(this); return resolve(this);
} }
if (requestedUrl === 'secure') { if (requestedRoute === 'secure') {
this.setProperties({ this.setProperties({
title: htmlSafe("Secure document viewing"), title: htmlSafe("Secure document viewing"),
allowAnonymousAccess: true, allowAnonymousAccess: true,
@ -77,6 +77,7 @@ export default Ember.Service.extend({
return this.get('ajax').request('public/meta').then((response) => { return this.get('ajax').request('public/meta').then((response) => {
this.setProperties(response); this.setProperties(response);
this.get('localStorage').storeSessionItem('entryUrl', requestedUrl);
return response; return response;
}); });
} }

View file

@ -46,6 +46,9 @@ export default BaseService.extend({
}).then((folder) => { }).then((folder) => {
let data = this.get('store').normalize('folder', folder); let data = this.get('store').normalize('folder', folder);
return this.get('store').push(data); return this.get('store').push(data);
}).catch((error) => {
this.get('router').transitionTo('/not-found');
return error;
}); });
}, },

View file

@ -1,6 +1,6 @@
{ {
"name": "documize", "name": "documize",
"version": "1.46.1", "version": "1.46.2",
"description": "The Document IDE", "description": "The Document IDE",
"private": true, "private": true,
"repository": "", "repository": "",

View file

@ -35,7 +35,7 @@ var Product core.ProdInfo
func init() { func init() {
Product.Major = "1" Product.Major = "1"
Product.Minor = "46" Product.Minor = "46"
Product.Patch = "1" Product.Patch = "2"
Product.Version = fmt.Sprintf("%s.%s.%s", Product.Major, Product.Minor, Product.Patch) Product.Version = fmt.Sprintf("%s.%s.%s", Product.Major, Product.Minor, Product.Patch)
Product.Edition = "Community" Product.Edition = "Community"
Product.Title = fmt.Sprintf("%s Edition", Product.Edition) Product.Title = fmt.Sprintf("%s Edition", Product.Edition)