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

feat: support arbitrary login redirect routes #522

Merged
merged 3 commits into from May 18, 2020

Conversation

hamidzr
Copy link
Contributor

@hamidzr hamidzr commented May 14, 2020

Description

DET-3068

Test Plan

Commentary (optional)

@cla-bot cla-bot bot added the cla-signed label May 14, 2020
@hamidzr hamidzr requested review from dzhu and hkang1 May 14, 2020 18:37
@justin-determined-ai justin-determined-ai changed the title feat: support arbitrary login redirect routes [DET-3068] feat: support arbitrary login redirect routes May 14, 2020
@justin-determined-ai justin-determined-ai changed the title [DET-3068] feat: support arbitrary login redirect routes feat: support arbitrary login redirect routes May 14, 2020
@hamidzr hamidzr added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label May 15, 2020
@hamidzr
Copy link
Contributor Author

hamidzr commented May 15, 2020

This is requested for EE

Copy link
Contributor

@hkang1 hkang1 left a comment

Choose a reason for hiding this comment

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

Looks good! Just minor comments, especially around avoiding mutation on function parameters as it can affect reactivity when dealing with non-primitive variables.


export const parseUrl = (url: string): URL => {
if (!isFullPath(url)) {
if (!url.startsWith('/')) url = '/' + url; // TODO assume url is absolute, or we could throw
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: could be a useful function

export const isAbsolutePath = (url: string): boolean => url.startsWith('/');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thoughts about handling relative urls? assume they're absolute or throw

webui/react/src/utils/routes.ts Outdated Show resolved Hide resolved

export const parseUrl = (url: string): URL => {
if (!isFullPath(url)) {
if (!url.startsWith('/')) url = '/' + url; // TODO assume url is absolute, or we could throw
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: avoid overwriting/mutating function parameters.
For this particular case it's not as significant because it's just a string, but would be good practice for when the objects are complex.
We should add this eslint rule: https://eslint.org/docs/rules/no-param-reassign

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. and the eslint rule sounds good too and if we need to do that for maybe performance reasons we can ignore it case by case

webui/react/src/routes/index.ts Outdated Show resolved Hide resolved
@hkang1 hkang1 assigned hamidzr and unassigned hkang1 May 18, 2020
@hamidzr hamidzr force-pushed the 3068-support-arbitrary-redirect branch from 1f338b9 to 5980a5c Compare May 18, 2020 17:39
@hamidzr hamidzr assigned hkang1 and unassigned hamidzr May 18, 2020
Copy link
Contributor

@hkang1 hkang1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@hkang1 hkang1 assigned hamidzr and unassigned hkang1 May 18, 2020
@hamidzr hamidzr merged commit 9c08cc6 into determined-ai:master May 18, 2020
@hamidzr hamidzr deleted the 3068-support-arbitrary-redirect branch May 18, 2020 19:58
@dannysauer dannysauer added this to the 0.12.5 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed to-cherry-pick Pull requests that need to be cherry-picked into the current release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants