Skip to content

On Logout, fetch the CSRF token #3173

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

Conversation

ashishkumar468
Copy link
Collaborator

@ashishkumar468 ashishkumar468 commented Oct 14, 2019

Fixes #3150 (comment)

Description (required)

  • Fetch the CSRF token
  • use the CSRF token to make the logout post call
  • once both of these succeed, clear the local data

Tests performed (required)

Tested prodDebug on Samsung S7 API 27

* use the CSRF token to make the logout post call
* once both of these succeed, clear the local data
Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

@codecov-io
Copy link

Codecov Report

Merging #3173 into backend-overhaul will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           backend-overhaul   #3173      +/-   ##
===================================================
- Coverage              5.79%   5.77%   -0.02%     
===================================================
  Files                   257     257              
  Lines                 11270   11308      +38     
  Branches                895     897       +2     
===================================================
  Hits                    653     653              
- Misses                10562   10600      +38     
  Partials                 55      55
Impacted Files Coverage Δ
...free/nrw/commons/theme/NavigationBaseActivity.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d897cfe...3b6762a. Read the comment docs.

@ashishkumar468 ashishkumar468 changed the title * On Logout, fetch the CSRF token On Logout, fetch the CSRF token Oct 14, 2019
* Fetch the CSRF token to logout
*/
private void handleLogout() {
service = ServiceFactory.get(commonsWikiSite);
Copy link
Member

Choose a reason for hiding this comment

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

Move this to a separate class. ie LogoutClient


progressDialog.show();
disposable.add(
service.getCsrfToken()
Copy link
Member

Choose a reason for hiding this comment

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

Use @Named(NAMED_COMMONS_CSRF)

/**
* Make the logout post call with the CSRF token fetched
*/
private void postLogoutApi(MwQueryResponse response) {
Copy link
Member

Choose a reason for hiding this comment

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

Move to LogoutClient or AuthClient

@ashishkumar468 ashishkumar468 deleted the bugfix/logout branch October 23, 2019 15:15
@maskaravivek
Copy link
Member

@ashishkumar468 have you opened a new PR for the same?

@ashishkumar468
Copy link
Collaborator Author

ashishkumar468 commented Oct 23, 2019

@maskaravivek Yes, this branch somehow got very much away from backend-overhaul, after we recently synced backend-overhaul with master, so as the changes were small, I thought making a new one would be quicker :-)

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