Skip to content

Commit

Permalink
Pass context to sendToken (#5003)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Mar 2, 2021
1 parent e4aa960 commit 6853479
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-foxes-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/auth': minor
---

Added `context` argument to `sendToken` function used by `passwordResetLink` and `magicAuthLink`.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<br>

<!-- ![CI](https://github.com/keystonejs/keystone/workflows/CI/badge.svg) -->

<!-- [![slack](https://keystone-community.now.sh//badge.svg)](https://keystone-community.now.sh/) -->

<!-- [![Supported by Thinkmill](https://thinkmill.github.io/badge/heart.svg)](http://thinkmill.com.au/?utm_source=github&utm_medium=badge&utm_campaign=react-select) -->

## Contents
Expand All @@ -36,6 +38,7 @@ The [Keystone 5](https://github.com/keystonejs/keystone-5) codebase is now in ac
For more information please read our [Keystone 5 and beyond](https://github.com/keystonejs/keystone-5/issues/21) post.

<!-- ## Getting Started -->

<!-- TBC -->

## Documentation
Expand All @@ -49,27 +52,35 @@ In the next month you'll see a new project starter and getting started guide, as
We'd love to hear your feedback, reach out on Twitter at [KeystoneJS](https://twitter.com/keystonejs) and [subscribe](https://next.keystonejs.com/roadmap#project-status) to be notified of our progress.

<!-- ## Version control -->

<!-- TBC -->

<!-- ## Contributing -->

<!-- TBC -->

<!-- ### Demo Projects -->

<!-- TBC -->

<!-- ### Development Practices -->

<!-- TBC -->

<!-- ### Setup -->

<!-- TBC -->

<!-- ### Testing -->

<!-- TBC -->

<!-- ### Unit Tests -->

<!-- TBC -->

<!-- ### End-to-End Tests -->

<!-- TBC -->

## Code of Conduct
Expand Down
2 changes: 1 addition & 1 deletion packages-next/auth/src/gql/getMagicAuthLinkSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function getMagicAuthLinkSchema<I extends string>({
resolveFields: false,
});

await magicAuthLink.sendToken({ itemId, identity, token });
await magicAuthLink.sendToken({ itemId, identity, token, context });
}
return null;
},
Expand Down
2 changes: 1 addition & 1 deletion packages-next/auth/src/gql/getPasswordResetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function getPasswordResetSchema<I extends string, S extends string>({
resolveFields: false,
});

await passwordResetLink.sendToken({ itemId, identity, token });
await passwordResetLink.sendToken({ itemId, identity, token, context });
}
return null;
},
Expand Down
8 changes: 7 additions & 1 deletion packages-next/auth/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { BaseGeneratedListTypes, AdminUIConfig, KeystoneConfig } from '@keystone-next/types';
import {
BaseGeneratedListTypes,
AdminUIConfig,
KeystoneConfig,
KeystoneContext,
} from '@keystone-next/types';

export type AuthGqlNames = {
CreateInitialInput: string;
Expand All @@ -25,6 +30,7 @@ export type SendTokenFn = (args: {
itemId: string | number;
identity: string;
token: string;
context: KeystoneContext;
}) => Promise<void> | void;

export type AuthTokenTypeConfig = {
Expand Down

1 comment on commit 6853479

@vercel
Copy link

@vercel vercel bot commented on 6853479 Mar 2, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.