Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remix-auth-email-link

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-auth-email-link - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

2

package.json
{
"name": "remix-auth-email-link",
"version": "1.5.0",
"version": "1.5.1",
"main": "./build/index.js",

@@ -5,0 +5,0 @@ "types": "./build/index.d.ts",

@@ -121,13 +121,9 @@ # Email Link Strategy - Remix Auth

// app/routes/login.tsx
import {
Form,
LoaderFunction,
ActionFunction,
json,
useLoaderData,
} from 'remix'
import { ActionArgs, LoaderArgs } from '@remix-run/node'
import { json } from '@remix-run/node'
import { Form, useLoaderData } from '@remix-run/react'
import { auth } from '~/services/auth.server'
import { sessionStorage } from '~/services/session.server'
export let loader: LoaderFunction = async ({ request }) => {
export let loader = async ({ request }: LoaderArgs) => {
await auth.isAuthenticated(request, { successRedirect: '/me' })

@@ -144,3 +140,3 @@ let session = await sessionStorage.getSession(request.headers.get('Cookie'))

export let action: ActionFunction = async ({ request }) => {
export let action = async ({ request }: ActionArgs) => {
// The success redirect is required in this action, this is where the user is

@@ -159,4 +155,3 @@ // going to be redirected after the magic link is sent, note that here the

export default function Login() {
let { magicLinkSent, magicLinkEmail } =
useLoaderData<{ magicLinkSent: boolean; magicLinkEmail?: string }>()
let { magicLinkSent, magicLinkEmail } = useLoaderData<typeof loader>()

@@ -187,7 +182,8 @@ return (

// app/routes/magic.tsx
import { LoaderFunction, ActionFunction, json } from 'remix'
import { LoaderArgs } from '@remix-run/node'
import { json } from '@remix-run/node'
import { auth } from '~/services/auth.server'
import { sessionStorage } from '~/services/session.server'
export let loader: LoaderFunction = async ({ request }) => {
export let loader = async ({ request }: LoaderArgs) => {
await auth.authenticate('email-link', request, {

@@ -209,6 +205,7 @@ // If the user was authenticated, we redirect them to their profile page

// app/routes/me.tsx
import { LoaderFunction, json } from 'remix'
import { LoaderArgs } from '@remix-run/node'
import { json } from '@remix-run/node'
import { auth } from '~/services/auth.server'
export let loader: LoaderFunction = async ({ request }) => {
export let loader = async ({ request }: LoaderArgs) => {
// If the user is here, it's already authenticated, if not redirect them to

@@ -221,3 +218,3 @@ // the login page.

export default function Me() {
let { user } = useLoaderData<{ user: User }>()
let { user } = useLoaderData<typeof loader>()
return (

@@ -224,0 +221,0 @@ <div>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc