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

fix: Redirect on 401 #17597

Merged
merged 22 commits into from
Dec 8, 2021
Merged

fix: Redirect on 401 #17597

merged 22 commits into from
Dec 8, 2021

Conversation

geido
Copy link
Member

@geido geido commented Nov 30, 2021

SUMMARY

Redirects the user to the login page when 401s responses are caught. It also passes the next_url param which is then used to redirect the user to the original page.

AFTER

DEV.Superset.1.mp4

TESTING INSTRUCTIONS

  1. Open any page
  2. Delete the cookies or wait for fo the auth to expire
  3. Make an action that generates a backend request
  4. Observe the behavior

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 2, 2021
@pull-request-size pull-request-size bot added size/S and removed size/M labels Dec 2, 2021
@geido geido marked this pull request as ready for review December 2, 2021 15:46
@geido geido requested a review from dpgaspar December 2, 2021 15:54
@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 3, 2021
@geido geido changed the title chore: Redirect on 401 fix: Redirect on 401 Dec 6, 2021
@pull-request-size pull-request-size bot added size/S and removed size/M labels Dec 6, 2021
@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 6, 2021
@codecov
Copy link

codecov bot commented Dec 6, 2021

Codecov Report

Merging #17597 (db2beac) into master (8c25f2f) will decrease coverage by 0.00%.
The diff coverage is 11.76%.

❗ Current head db2beac differs from pull request most recent head a23a886. Consider uploading reports for the commit a23a886 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17597      +/-   ##
==========================================
- Coverage   68.86%   68.85%   -0.01%     
==========================================
  Files        1598     1598              
  Lines       65297    65304       +7     
  Branches     6952     6953       +1     
==========================================
+ Hits        44966    44967       +1     
- Misses      18446    18451       +5     
- Partials     1885     1886       +1     
Flag Coverage Δ
javascript 57.46% <11.76%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rc/explore/components/ExploreChartHeader/index.jsx 46.57% <0.00%> (-0.65%) ⬇️
superset/config.py 91.58% <ø> (ø)
...rset-ui-core/src/connection/SupersetClientClass.ts 90.76% <33.33%> (-7.54%) ⬇️

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 8c25f2f...a23a886. Read the comment docs.

Copy link
Member

@suddjian suddjian left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Works great!
1 suggestion for a ux improvement in another PR - we should display a banner on login page that would inform user that their session expired

@kgabryje
Copy link
Member

kgabryje commented Dec 7, 2021

Tested 1 more scenario and I noticed that I'm not getting redirected back to the original page when I log in
EDIT: Nevermind, I forgot to rerun pip with bumped fab 🤦 After doing that, works perfectly

Screen.Recording.2021-12-07.at.11.18.50.mov

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 7, 2021
@rusackas rusackas merged commit 46cdc77 into apache:master Dec 8, 2021
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Dec 10, 2021
* Redirect on 401

* Bump FAB

* Format

* Update Cypress save test

* Revert Cypress change

* Bump FAB 3.4.1rc2

* Update test

* Update return statement

* Update api test

* Update datasets api test

* Update datasets api 401s to 403s

* Add typeguard

* Use Promise.resolve

* Update callApiAndParseWithhTimeout test

* Disable parseResponse test

* Try catch

* Handle npm 8 issues

(cherry picked from commit 46cdc77)
@jinghua-qa
Copy link
Member

🏷️ 2021.49

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2021.49 size/L 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants