Skip to content

Change logout button to HTTP POST in admin area#2568

Draft
anusharanganathan wants to merge 3 commits intodevelopfrom
feature/4350_admin_area_logout
Draft

Change logout button to HTTP POST in admin area#2568
anusharanganathan wants to merge 3 commits intodevelopfrom
feature/4350_admin_area_logout

Conversation

@anusharanganathan
Copy link
Copy Markdown
Contributor


Change logout button to HTTP POST in admin area

briefly describe the PR here

This PR...

  • has scripts to run
  • has migrations to run
  • adds new infrastructure
  • changes the CI pipeline
  • affects the public site
  • affects the editorial area
  • affects the publisher area
  • affects the monitoring

Developer Checklist

Developers should review and confirm each of these items before requesting review

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Project's coding standards are met
    • No deprecated methods are used
    • No magic strings/numbers - all strings are in constants or messages files
    • ES queries are wrapped in a Query object rather than inlined in the code
    • Where possible our common library functions have been used (e.g. dates manipulated via dates)
    • Cleaned up commented out code, etc
    • Urls are constructed with url_for not hard-coded
  • Code documentation and related non-code documentation has all been updated
  • Migration has been created and tested
  • There is a recent merge from develop

Reviewer Checklist

Reviewers should review and confirm each of these items before approval
If there are multiple reviewers, this section should be duplicated for each reviewer

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Project's coding standards are met
    • No deprecated methods are used
    • No magic strings/numbers - all strings are in constants or messages files
    • ES queries are wrapped in a Query object rather than inlined in the code
    • Where possible our common library functions have been used (e.g. dates manipulated via dates)
    • Cleaned up commented out code, etc
    • Urls are constructed with url_for not hard-coded
  • Code documentation and related non-code documentation has all been updated
  • Migration has been created and tested
  • There is a recent merge from develop

Testing

List user test scripts that need to be run

  • Login as admin
  • Goto the Admin dashboard
  • Click on Logout

It should take you to the homepage with the message you are now logged out

List any non-unit test scripts that need to be run by reviewers

@anusharanganathan
Copy link
Copy Markdown
Contributor Author

anusharanganathan commented Mar 27, 2026

@richard-jones and @amdomanska there are two things I’d like to raise

  1. The code has inline css. I was not sure of the best place to add in the scss (also I need to learn how to compile the scss)

  2. The form tag encloses both the logout button and the link to settings. Adding the form tag within <p><small> was ignored by the browser. It created an empty <p> tag and it placed the form tag above the <small> tag.

@amdomanska
Copy link
Copy Markdown
Contributor

amdomanska commented Mar 30, 2026

@anusharanganathan
the scss can go to cms/sass/components/_buttons.scss but as this is quite specific case it can stay inline as well.

SCSS is compiled automatically by re-running the project.

Copy link
Copy Markdown
Contributor

@amdomanska amdomanska left a comment

Choose a reason for hiding this comment

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

Regarding the <form> and the link - you are right, the settings link within the form tag is not ideal. We could move it under the form, enclose everything in section and then style it appropriately.

@anusharanganathan
Copy link
Copy Markdown
Contributor Author

anusharanganathan commented Mar 30, 2026

Regarding the <form> and the link - you are right, the settings link within the form tag is not ideal. We could move it under the form, enclose everything in section and then style it appropriately.

@Aga I tried enclosing it all in section. If I do that, we would need some more styling as you said. The settings button is wider than the logout button. A <p> tag within the div made no difference.

        <section>
            <div style="display: inline-block;">
                <form method="POST" action="{{ url_for('account.logout') }}">
                    <small>
                        <button type="submit" id="logout" class="tag" style="vertical-align: inherit;">
                            Logout
                            <span data-feather="log-out" aria-hidden="true"></span>
                        </button>
                    </small>
                </form>
            </div>
            <div style="display: inline-block;">
                <a href="{{ url_for('account.username', username=current_user.id) }}" class="tag">
                    <span data-feather="settings" aria-hidden="true"></span>
                    Settings
                </a>
            </div>
        </section>
Screenshot 2026-03-30 at 15 45 20

Could I please hand this over to you.

@anusharanganathan
Copy link
Copy Markdown
Contributor Author

@varadekd how is the form tag rendered in the browser? Can you please inspect and check. My first attempt was a code similar to yours, the tags were swapped.

@varadekd
Copy link
Copy Markdown
Contributor

varadekd commented Apr 1, 2026

@amdomanska Please review the latest changes

@anusharanganathan anusharanganathan requested review from amdomanska and removed request for richard-jones April 1, 2026 16:29
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.

3 participants