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

cloudflare-auth

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-auth - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

4

demo/functions/dash/index.ts

@@ -1,2 +0,2 @@

import { html, htmlResponse } from 'cloudflare-htmx';
import { html, view } from 'cloudflare-htmx';
import { getJWTPayload, logout, Env } from 'cloudflare-auth';

@@ -10,3 +10,3 @@

const payload = await getJWTPayload(request, env);
return htmlResponse(
return view(
html`

@@ -13,0 +13,0 @@ <div class="text-center pt-10 h-screen">

@@ -1,5 +0,5 @@

import { html, htmlResponse } from 'cloudflare-htmx';
import { html, view } from 'cloudflare-htmx';
export const onRequestGet: PagesFunction = () =>
htmlResponse(html`<div class="w-full h-screen p-10 text-center">
view(html`<div class="w-full h-screen p-10 text-center">
<div class="flex justify-center pt-24 lg:pt-64">

@@ -6,0 +6,0 @@ <div class="p-4 md:p-0 w-full md:w-96">

import { Env, loginWithToken } from 'cloudflare-auth';
import Toast from '@components/Toast';
import { html, htmlResponse } from 'cloudflare-htmx';
import { html, view } from 'cloudflare-htmx';

@@ -10,11 +10,11 @@ export const onRequestPost: PagesFunction<Env> = async ({ request, env }) => {

if (!email) {
return htmlResponse(Toast('Email not specified'));
return view(Toast('Email not specified'));
}
try {
const magicLink = await loginWithToken(email, env, url.origin, true);
return htmlResponse(Toast(html` <a class="link text-primary" href="${magicLink}">Click here to login</a> `, 'alert-success', false));
return view(Toast(html` <a class="link text-primary" href="${magicLink}">Click here to login</a> `, 'alert-success', false));
} catch (e) {
console.error(e);
return htmlResponse(Toast('Magic link failed to send!', 'alert-failure'));
return view(Toast('Magic link failed to send!', 'alert-failure'));
}
};
import { isAuthorised, Env } from 'cloudflare-auth';
import { html, htmlResponse } from 'cloudflare-htmx';
import { html, view } from 'cloudflare-htmx';

@@ -7,5 +7,5 @@ export const onRequestGet: PagesFunction<Env> = async ({ request, env }) => {

if (authorised) {
return htmlResponse(html`<h1 class="text-3xl text-primary">You are authorised!</h1>`);
return view(html`<h1 class="text-3xl text-primary">You are authorised!</h1>`);
}
return htmlResponse(html`<h1 class="text-3xl text-error">You are not authorised!</h1>`);
return view(html`<h1 class="text-3xl text-error">You are not authorised!</h1>`);
};

@@ -9,4 +9,4 @@ import { verify, Env } from 'cloudflare-auth';

} catch {
return Response.redirect(url.origin, 301);
return Response.redirect(url.origin, 303);
}
};
{
"name": "cloudflare-auth",
"version": "1.4.0",
"version": "1.5.0",
"description": "JWT implementation for Cloudflare using D1",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -67,3 +67,3 @@ # cloudflare-auth - Simple Auth for Cloudflare Pages

} catch {
return Response.redirect(url.origin, 301);
return Response.redirect(url.origin, 303);
}

@@ -70,0 +70,0 @@ };

@@ -84,3 +84,3 @@ import { Kysely } from 'kysely';

return new Response(null, {
status: 301,
status: 303,
headers: {

@@ -99,3 +99,3 @@ Location: redirectTo,

return new Response(null, {
status: 301,
status: 303,
headers: {

@@ -102,0 +102,0 @@ Location: loginPath,

@@ -61,3 +61,3 @@ import { Kysely } from 'kysely';

return new Response(null, {
status: 301,
status: 303,
headers: {

@@ -64,0 +64,0 @@ Location: redirectTo,

@@ -22,3 +22,3 @@ import * as jose from 'jose';

const url = new URL(request.url);
return Response.redirect(url.origin, 301);
return Response.redirect(url.origin, 303);
}

@@ -25,0 +25,0 @@ };

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