Merge remote-tracking branch 'guerler/login_routes' into dev

This commit is contained in:
Dannon Baker
2017-04-27 15:41:51 -04:00
4 changed files with 20 additions and 8 deletions
+15 -3
View File
@@ -95,13 +95,16 @@ window.app = function app( options, bootstrapped ){
var queryObj = QUERY_STRING.parse( args.pop() );
args.push( queryObj );
if( callback ){
callback.apply( this, args );
if ( this.authenticate( args, name ) ) {
callback.apply( this, args );
} else {
this.push( Galaxy.root );
}
}
},
routes : {
'(/)' : 'home',
// TODO: remove annoying 'root' from root urls
'(/)root*' : 'home',
'(/)tours(/)(:tour_id)' : 'show_tours',
'(/)user(/)' : 'show_user',
@@ -109,6 +112,15 @@ window.app = function app( options, bootstrapped ){
'(/)custom_builds' : 'show_custom_builds'
},
require_login: [
'show_user',
'show_user_form'
],
authenticate: function( args, name ) {
return ( Galaxy.user && Galaxy.user.id ) || this.require_login.indexOf( name ) == -1;
},
show_tours : function( tour_id ){
if ( tour_id ){
Tours.giveTour( tour_id );
@@ -197,4 +209,4 @@ window.app = function app( options, bootstrapped ){
pushState : true,
});
});
};
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long