# Password Protected Page Logout

**URL:** <https://community.hubspot.com/t/password-protected-page-logout/89451>\
**Category:** CMS Development\
**Tags:** developer\
**Created:** [September 12, 2023, 1:03pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451 "2023-09-12T13:03:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CBelga](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CBelga](https://community.hubspot.com/u/CBelga)\
**Post date:** [September 12, 2023, 1:03pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/1 "2023-09-12T13:03:25Z")

</div>

In my understanding, once the correct password is entered on a password-protected HubSpot page, continuous access is granted every time the page is revisited. However, I would like to implement a “Logout” button. This would ensure that users are required to re-enter the password upon each visit, following their decision to log out. Has anyone among you been able to implement this?

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [September 13, 2023, 8:11am UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/2 "2023-09-13T08:11:08Z")

</div>

Hello @CBelga  
You can use HubSpot custom module. There is a custom module called “Logout” that can be used to add a logout button to a page.

---

<div class="post-metadata">

**Author:** ![CBelga](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CBelga](https://community.hubspot.com/u/CBelga)\
**Post date:** [September 13, 2023, 12:38pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/3 "2023-09-13T12:38:37Z")

</div>

I can’t seem to find this Logout custom module. What I know is that you can logout a user by creating a button/link that will redirect them to “/\_hcms/mem/logout” but this is for a registration required page and does not work for a password required page

---

<div class="post-metadata">

**Author:** ![SophieHull](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sophiehull/32/45327_2.png) [@SophieHull](https://community.hubspot.com/u/SophieHull)\
**Post date:** [September 13, 2023, 2:40pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/4 "2023-09-13T14:40:10Z")

</div>

I believe what you’re looking for is a session management feature rather than just a password-protected page. Session management would allow you to log users out after a certain period of inactivity or when they explicitly click a “Logout” button. You might need to use custom code or integrate third-party solutions to achieve this specific functionality with HubSpot.

---

<div class="post-metadata">

**Author:** ![CBelga](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CBelga](https://community.hubspot.com/u/CBelga)\
**Post date:** [September 13, 2023, 2:47pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/5 "2023-09-13T14:47:57Z")

</div>

In this instance, I’m looking to utilize a page that is protected by a password. I’m aware that a cookie is generated once the correct password is entered. This cookie always contains a “\_key” and if it’s removed, the user will be prompted to re-enter the password upon revisiting the page. However, the cookie with the “\_key” is HttpOnly, implying it can only be deleted from the server-side. I attempted to use serverless and “Set-Cookie” to delete the cookie by assigning it an “expires” attribute with a past date value, but it was unsuccessful.

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [September 15, 2023, 8:58pm UTC](https://community.hubspot.com/t/password-protected-page-logout/89451/6 "2023-09-15T20:58:14Z")

</div>

@CBelga because it is a password protected page (using the cookie key) and not a membership page (using sessions) there isn’t a way that I know to prevent a returning visitor from accessing the page again unless you change the password or expire the page.
