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

Add signUpPaths configuration #123

Merged
merged 7 commits into from
Nov 11, 2024
Merged

Add signUpPaths configuration #123

merged 7 commits into from
Nov 11, 2024

Conversation

PaulAsjes
Copy link
Contributor

Fixes #121

Adds signUpPaths to middleware configuration, which allows you to specify which paths should show the "sign up" screen hint over the default "sign in".

@PaulAsjes PaulAsjes requested a review from mthadley November 7, 2024 10:21
Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

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

Just have one question regarding getScreenHint.

src/session.ts Outdated
Comment on lines 365 to 372
if (!Array.isArray(signUpPaths)) {
return signUpPaths.includes(pathname) ? 'sign-up' : 'sign-in';
}

const screenHintPaths: string[] = signUpPaths.filter((pathGlob) => {
const pathRegex = getMiddlewareAuthPathRegex(pathGlob);
return pathRegex.exec(pathname);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we pass the paths through getMiddlewareAuthPathRegex if signUpPaths is an array, but not if it's a single value? Could a single value also be a path glob?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an excellent point!

@PaulAsjes PaulAsjes merged commit 8c225f2 into main Nov 11, 2024
@PaulAsjes PaulAsjes deleted the pma/configure-screen-hints branch November 11, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Configure redirect URI screen hints
2 participants