Skip to content

Commit

Permalink
Remix v2 (#42)
Browse files Browse the repository at this point in the history
* update dependencies

* fix formData for remix version 2

* revert to 2.0.2
  • Loading branch information
edgesoft authored Oct 12, 2023
1 parent beb5b8f commit 6a5dcf2
Show file tree
Hide file tree
Showing 3 changed files with 1,738 additions and 1,510 deletions.
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,30 @@
"README.md"
],
"peerDependencies": {
"@remix-run/server-runtime": "^1.1.1",
"remix-auth": "^3.2.1"
"@remix-run/server-runtime": "^2.0.1",
"remix-auth": "^3.6.0"
},
"devDependencies": {
"@remix-run/node": "^1.1.1",
"@remix-run/react": "^1.1.1",
"@remix-run/server-runtime": "^1.1.1",
"@remix-run/node": "^2.0.1",
"@remix-run/react": "^2.0.1",
"@remix-run/server-runtime": "^2.0.1",
"@types/crypto-js": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"core-js-pure": "^3.33.0",
"eslint": "^8.5.0",
"eslint-config-galex": "^3.5.3",
"husky": ">=6",
"lint-staged": ">=12.1.4",
"prettier": "^2.5.1",
"react": "^17.0.2",
"remix-auth": "^3.2.1",
"react": "^18.0.2",
"remix-auth": "^3.6.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
"typescript": "^5.2.0"
},
"dependencies": {
"crypto-js": "^4.1.1"
"crypto-js": "^4.1.1",
"yarn": "^1.22.19"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "yarn lint",
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ export class EmailLinkStrategy<User> extends Strategy<
)

const form = new URLSearchParams(await request.text())
const formData = new FormData();

// Convert the URLSearchParams to FormData
for (const [name, value] of form) {
formData.append(name, value);
}


// This should only be called in an action if it's used to start the login process
if (request.method === 'POST') {
Expand Down Expand Up @@ -219,7 +226,7 @@ export class EmailLinkStrategy<User> extends Strategy<

const domainUrl = this.getDomainURL(request)

const magicLink = await this.sendToken(emailAddress, domainUrl, form)
const magicLink = await this.sendToken(emailAddress, domainUrl, formData)

session.set(this.sessionMagicLinkKey, await this.encrypt(magicLink))
session.set(this.sessionEmailKey, emailAddress)
Expand Down
Loading

0 comments on commit 6a5dcf2

Please sign in to comment.