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 bug in passwordResetLink #4965

Merged
merged 3 commits into from
Mar 3, 2021
Merged

Fix bug in passwordResetLink #4965

merged 3 commits into from
Mar 3, 2021

Conversation

timleslie
Copy link
Contributor

These field names need to correspond to const tokenType = 'passwordReset'; in getPasswordSchemaReset.ts. They aren't meant to be dynamic on the field name.

@vercel
Copy link

vercel bot commented Mar 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/6QjhrPC6YGzjCvFtGyEf5X63poRM
✅ Preview: https://keystone-next-docs-git-fix-auth-field-names-keystonejs.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Mar 1, 2021

🦋 Changeset detected

Latest commit: 54112a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@keystone-next/auth Major
@keystone-next/example-auth Patch
@keystone-next/app-basic Patch
@keystone-next/example-ecommerce Patch
@keystone-next/example-roles Patch
@keystone-next/example-todo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@timleslie timleslie requested a review from a team March 1, 2021 02:38
@timleslie timleslie enabled auto-merge (squash) March 1, 2021 02:38
@JedWatson
Copy link
Member

You mean getPasswordSchemaReset.ts

@JedWatson
Copy link
Member

JedWatson commented Mar 1, 2021

So overall I think I'm in favour of this, but I'd like to go more comprehensively in one direction or the other.

These fields were supposed to be variable, because it's a "secret" and may not be called "password".

But can we be consistent? it's configured as a secret field, which is almost always called password, and we're hard-coding password in some places while it's still secret in others. Confusing.

I don't think I'm unhappy with this PR, since among other things it fixes a bug, but I do think I'm unhappy with the overall balance of apparently-configurable vs not-actually-configurable combined with (I think) we use two words for the same thing.

@timleslie if you agree, we should probably backlog another pass to clean this up properly even further, align on one consistent term, and be more opinionated overall in the name of simplicity (tbh at this point I'd go for "password" over "secret", and I think "secret" is a hangover from Keystone 5 when it genuinely was less opinionated)

(to be clear, I'm not suggesting we hard code the two primary fields - currently, identity and secret - they are defined by the list schema and only referred to here, that's fine. but you configure the "secret" field, and then we call it "password" in the context of resetting it, and that's confusing... except that devs using keystone will, if they follow the defaults / examples, see "password" and "passwordReset" columns in their database and that actually does make sense 🤦‍♂️)

@@ -0,0 +1,5 @@
---
'@keystone-next/auth': patch
Copy link
Member

Choose a reason for hiding this comment

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

This isn't a patch; it changes database structure for anyone using auth with a field path other than password for the secret field.

We can decide to ship this as a breaking change, or we can fix the bug in the other direction (by making getPasswordResetSchema.ts generate the field path dynamically based on the secretField config when the tokenType is passwordReset)

@timleslie timleslie requested a review from JedWatson March 1, 2021 21:00
@vercel vercel bot temporarily deployed to Preview March 1, 2021 21:19 Inactive
@vercel vercel bot temporarily deployed to Preview March 1, 2021 22:38 Inactive
@vercel vercel bot temporarily deployed to Preview March 2, 2021 02:11 Inactive
@vercel vercel bot temporarily deployed to Preview March 2, 2021 02:19 Inactive
@vercel vercel bot temporarily deployed to Preview March 2, 2021 22:11 Inactive
@vercel vercel bot temporarily deployed to Preview March 2, 2021 23:52 Inactive
@vercel vercel bot temporarily deployed to Preview March 3, 2021 00:06 Inactive
@timleslie timleslie merged commit a00a382 into master Mar 3, 2021
@timleslie timleslie deleted the fix-auth-field-names branch March 3, 2021 00:14
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.

2 participants