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
v1.46.1
v1.46.2
## OS Support

View file

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

View file

@ -22,14 +22,15 @@ export default Ember.Route.extend(ApplicationRouteMixin, TooltipMixin, {
appMeta: service(),
session: service(),
pinned: service(),
localStorage: service(),
beforeModel(transition) {
this._super(...arguments);
return this.get('appMeta').boot(transition.targetName).then(data => {
if (this.get('session.session.authenticator') !== "authenticator:documize" &&
this.get('session.session.authenticator') !== "authenticator:keycloak" &&
data.allowAnonymousAccess) {
let sa = this.get('session.session.authenticator');
return this.get('appMeta').boot(transition.targetName, window.location.href).then(data => {
if (sa !== "authenticator:documize" && sa !== "authenticator:keycloak" && data.allowAnonymousAccess) {
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: {
willTransition: function( /*transition*/ ) {
Mousetrap.reset();

View file

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

View file

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

View file

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

View file

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