Redirect to list view after login

I’m trying to override the home page for all roles, and after login redirect the users to /app/doctype/view/list instead of the app/desk. Any idea to trigger that redirect after the login?

The only way that has worked for me is to add a redirect-to query param to the login url: e.g. http://localhost:8000/?redirect-to=/app/crate#login

You could do with some custom JS or a custom login page.

Incidentally, I have tried various ways to do this without much success:

  • Using the Auth Hooks to add the URL to frappe.flags and frappe.local.flags (neither works, as they are overwritten by the cache) or setting the cache directly (set but ignored in any case).
def on_login(login_manager):
    frappe.cache().hset("redirect_after_login", login_manager.user, "/app/crate")

$('.btn-login').click(function(){    
     setTimeout(function(){
           location.href = "/app/lead"
     }, 300);
})

This code put in website script to redirect lead list

1 Like