Change website user page after login

Hi,

I want to change website users default page after login,
now after logging its routing to /me, i want to change it to my custom page.

This may help:

1 Like

hi, @kennethsequeira, thanks for replying,

I found below code in the file,

def get_context(context):
	redirect_to = frappe.local.request.args.get("redirect-to")
	if frappe.session.user != "Guest":
		if not redirect_to:
			redirect_to = "/" if frappe.session.data.user_type=="Website User" else "/desk"
		frappe.local.flags.redirect_location = redirect_to
		raise frappe.Redirect 

For testing i override redirect_to variable but its taking no effect, i already did bench restart.

redirect_to = "/lms"
frappe.local.flags.redirect_location = redirect_to
raise frappe.Redirect
2 Likes

Hi @shahid,
have you checked “Website Settings”, section “HTML HEADER, ROBOTS AND REDIRECTS”. There you find a table “Route Redirects”.

Hi @shahid
Mybe these links could help you:
https://frappeframework.com/docs/user/en/guides/portal-development/redirects

https://frappeframework.com/docs/user/en/python-api/hooks#website-redirects

hi @Patrick.St, i found route redirects table, here i got 2 columns source and target, how can i define here that website user default login page will be /custom-page?

Hey Shahid,

Did you found solution to that?

I want that if a user has desk permission then after login he redirects to /me. If you have any references then please share it with me.

This post might also help.