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 to '?redirect' query parameter after successful login #307

Merged
merged 3 commits into from
Feb 17, 2022

Conversation

bryphe-coder
Copy link
Contributor

Fixes #304
Unblocks #298

After logging in, the login flow should redirect to a whatever path is specified by the ?redirect query parameter. This is important for cases like #298 - where we need to set ?redirect=%2Fcli_auth, but also really any case where the user is linked and might have to go back to the login screen.

The fix is simple - just check if the redirect query parameter is set, and if it is, use that as the path to redirect to on success. Also adds a test case - we had one checking that we redirect to the default (root /) url, but not one of the ?redirect param

@bryphe-coder bryphe-coder self-assigned this Feb 16, 2022
@codecov
Copy link

codecov bot commented Feb 16, 2022

Codecov Report

Merging #307 (99054f9) into main (4954a6b) will increase coverage by 0.07%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
+ Coverage   67.95%   68.02%   +0.07%     
==========================================
  Files         135      135              
  Lines        7149     7156       +7     
  Branches       73       74       +1     
==========================================
+ Hits         4858     4868      +10     
+ Misses       1804     1800       -4     
- Partials      487      488       +1     
Flag Coverage Δ
unittest-go-macos-latest 66.36% <ø> (+0.21%) ⬆️
unittest-go-ubuntu-latest 67.59% <ø> (+0.32%) ⬆️
unittest-go-windows-latest 65.98% <ø> (-0.06%) ⬇️
unittest-js 64.81% <88.88%> (+0.19%) ⬆️
Impacted Files Coverage Δ
site/components/SignIn/SignInForm.tsx 96.87% <88.88%> (-3.13%) ⬇️
provisioner/echo/serve.go 47.36% <0.00%> (-3.16%) ⬇️
peer/conn.go 79.48% <0.00%> (-1.29%) ⬇️
coderd/provisionerdaemons.go 57.84% <0.00%> (ø)
peer/channel.go 87.19% <0.00%> (+2.43%) ⬆️
peerbroker/dial.go 85.71% <0.00%> (+9.52%) ⬆️

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 4954a6b...99054f9. Read the comment docs.

@bryphe-coder bryphe-coder merged commit c2ad91b into main Feb 17, 2022
@bryphe-coder bryphe-coder deleted the bryphe/fix/304/login-redirect branch February 17, 2022 16:35
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.

Login ignores ?redirect parameter
2 participants