I am trying to develop a website, using a template/theme of my own. I have the “logout” button. How to add the functionality to logout and go back to login page while clicking the button.
This is the logout button. I have added the template html and python file inside “www” folder of my custom app.
1 Like
This is how I do it in a custom template I’m currently working on.
{% if frappe.session.user != 'Guest' %}
<div class="top_bar_contact_item ml-auto">
<a style="cursor: pointer" onclick="return frappe.app.logout()">Logout</a>
</div>
<div class="top_bar_contact_item">
<a href="/me">My Account</a>
</div>
{% else %}
<div class="top_bar_contact_item ml-auto">
<a href="/login">Log In</a>
</div>
{% endif %}
Hope that helps.
1 Like
This is helpful.
The function return frappe.app.logout()
doesn’t seem to be recognized in html. Any workaround?
rahy
November 20, 2022, 10:35am
4
I think the frappe.app.logout
had moved to frappe.auth.logout
.
But I don’t know if they have the same functionality.
1 Like