Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logout function in base.html #537

Closed
wants to merge 1 commit into from

Conversation

8bitaby
Copy link

@8bitaby 8bitaby commented Mar 5, 2024

Update logout function in base.html

This commit updates the logout functionality in the base template (base.html) to improve security and adhere to best practices. The previous implementation used a simple link for logout, which could be susceptible to cross-site request forgery (CSRF) attacks.

The updated code replaces the logout link with a form submission method, utilizing the POST request with CSRF protection. This approach enhances the security of the logout functionality by ensuring that requests to the logout URL are only accepted from authorized sources, preventing potential unauthorized access or malicious actions.

Additionally, the use of a form submission method allows for better compatibility with server-side processing and future scalability. The form includes a CSRF token to mitigate CSRF attacks, providing an additional layer of security.

By making this change, we are prioritizing security and robustness in our application's authentication mechanisms, aligning with industry best practices and ensuring a safer user experience.

This commit addresses issue #536 and implements the recommended solution. Tested locally to ensure proper functionality.

Update logout function in base.html

This commit updates the logout functionality in the base template (`base.html`) to improve security and adhere to best practices. The previous implementation used a simple link for logout, which could be susceptible to cross-site request forgery (CSRF) attacks. 

The updated code replaces the logout link with a form submission method, utilizing the POST request with CSRF protection. This approach enhances the security of the logout functionality by ensuring that requests to the logout URL are only accepted from authorized sources, preventing potential unauthorized access or malicious actions.

Additionally, the use of a form submission method allows for better compatibility with server-side processing and future scalability. The form includes a CSRF token to mitigate CSRF attacks, providing an additional layer of security.

By making this change, we are prioritizing security and robustness in our application's authentication mechanisms, aligning with industry best practices and ensuring a safer user experience.

This commit addresses issue farridav#536  and implements the recommended solution. Tested locally to ensure proper functionality.
Copy link
Author

@8bitaby 8bitaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this change.

@sa11erto5n
Copy link

i found the same error, so i created a new logout view and edited the base.html so it triggers my new view.
I went to create a new pull request but since you already did i won't

@jamesgilmorelyst
Copy link

Duplicates #523

@farridav
Copy link
Owner

Closing as solved in #544 Thanks for the contribution ;)

@farridav farridav closed this Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants