Redirect to login



  • hi,

    is there a quick hack to redirect guest (non logged in ) user to /login?

    i did search and found some answer with modifying some core, and its over a year old, and not sure if that still relevant.

    thanks!


  • Admin

    Put this in your custom js section in your ACP

    <script>
    $(window).on('action:ajaxify.end', function(ev, data) {
        if (data.url !== 'login' && !app.user.uid) {
              ajaxify.go('login');
        }
    });
    </script>
    


  • works! :) thank you so much @baris



  • oops, now new user cant register, it keeps redirect to login,

    fixed

    if (data.url !== 'login' && data.url !== 'register' && !app.user.uid) {


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.