Skip to content

Commit

Permalink
anon redirect before/after login
Browse files Browse the repository at this point in the history
  • Loading branch information
HarveyKandola committed May 3, 2017
1 parent f8e091d commit f48740e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions app/app/components/customize/global-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default Ember.Component.extend({

saveLicense() {
this.get('saveLicense')().then(() => {
window.location.reload();
});
}
}
Expand Down
22 changes: 17 additions & 5 deletions app/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,33 @@ 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);
}

return;
});
},

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();
Expand Down
5 changes: 3 additions & 2 deletions app/app/services/app-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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;
});
}
Expand Down
3 changes: 3 additions & 0 deletions app/app/services/folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
},

Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "documize",
"version": "1.46.1",
"version": "1.46.2",
"description": "The Document IDE",
"private": true,
"repository": "",
Expand Down
2 changes: 1 addition & 1 deletion core/api/endpoint/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f48740e

Please sign in to comment.