<commit_before>(function(){
    var redirectKey = 'ir.loginRedirectRoute';
    Session.set(redirectKey, null);
    
    _.extend(Router, {
       _route: Router.route,
        route: function(name, options){
            if(options.redirectOnLogin && Session.get(redirectKey)){
                var rname = Session.get(redirectKey);
                Session.set(redirectKey, null);
                
                return this.redirect(rname);
            }
            
            if(options.loginRequired || options.redirectOnLogin){
                var before = null;
                if(options.before && _.isFunction(options.before)){
                    before = options.before;   
                }
                
                options.before = function(){
                    if(options.redirectOnLogin && Meteor.user()){
                        if(Session.get(redirectKey)){
                            var rname = Session.get(redirectKey);
                            Session.set(redirectKey, null);
                            
                            return this.redirect(rname);
                        }
                    }
                    
                    if(options.loginRequired){
                        if(!Meteor.user()){
                            Session.set(redirectKey, Router.current().path);
                            return this.redirect(options.loginRequired);   
                        }
                    }
                    
                    if(before)before.call(this);
                };
            }
            
            Router._route(name, options);
        }
    });
})();<commit_msg>initial ability to show view or redirect<commit_after>(function(){
    var redirectKey = 'ir.loginRedirectRoute';
    Session.set(redirectKey, null);
    
    _.extend(Router, {
       _route: Router.route,
        route: function(name, options){
            if(options.redirectOnLogin && Session.get(redirectKey)){
                var rname = Session.get(redirectKey);
                Session.set(redirectKey, null);
                
                return this.redirect(rname);
            }
            
            if(options.loginRequired || options.redirectOnLogin){
                var before = null;
                if(options.before && _.isFunction(options.before)){
                    before = options.before;   
                }
                
                options.before = function(){
                    if(options.redirectOnLogin && Meteor.user()){
                        if(Session.get(redirectKey)){
                            var rname = Session.get(redirectKey);
                            Session.set(redirectKey, null);
                            
                            return this.redirect(rname);
                        }
                    }
                    
                    if(options.loginRequired){
                        if(typeof options.loginRequired == 'string' || options.loginRequired instanceof String){
                            var routeName = options.loginRequired;

                            options.loginRequired = {
                                name: routeName,
                                shouldRoute: true
                            };
                        }

                        if(!options.loginRequired.hasOwnProperty('shouldRoute')){
                            options.loginRequired.shouldRoute = true;
                        }

                        if(!Meteor.user()){
                            Session.set(redirectKey, Router.current().path);
                            if(options.loginRequired.shouldRoute){
                                return this.redirect(options.loginRequired.name);       
                            }else{
                                return this.render(options.loginRequired.name);
                            }
                        }
                    }
                    
                    if(before)before.call(this);
                };
            }
            
            Router._route(name, options);
        }
    });
})();
{'fraction_non_alphanumeric': 0.09139393939393939, 'fraction_numerical': 0.0, 'mean_word_length': 0.958234456573327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169343', 'n_tokens_mistral': 908, 'n_tokens_neox': 851, 'n_words': 129}