Skip to content

Commit

Permalink
Refactor docs (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Aug 13, 2023
1 parent d4ba0cb commit 10019b4
Show file tree
Hide file tree
Showing 146 changed files with 1,084 additions and 1,172 deletions.
24 changes: 12 additions & 12 deletions .eslintrc.cjs → .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
extends: ["prettier"],
rules: {
{
"extends": [
"prettier",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
Expand All @@ -9,12 +14,7 @@ module.exports = {
"no-async-promise-executor": "off",
"no-useless-catch": "off"
},
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
plugins: ["@typescript-eslint"],
ignorePatterns: ["*.cjs"]
};
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["*.cjs"]
}
10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"useTabs": true,
"trailingComma": "none",
"plugins": ["prettier-plugin-tailwindcss"],
"plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
],
"pluginSearchDirs": ["."]
}
2 changes: 1 addition & 1 deletion documentation/content/blog/lucia-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ As of writing, the project has over 750 stars and nearly 3,000 weekly downloads.

and, of course, a big thanks to everyone who has contributed! [Valentin Rogg](https://github.com/v-rogg), [Blastose](https://github.com/Blastose), [Ingo Krumbein](https://github.com/Jings), [Felipe dos Santos](https://github.com/ffss92), [Dana Woodman](https://github.com/danawoodman), [Alexander Way](https://github.com/alex-way), [captaindirgo](https://github.com/captaindirgo), [Christopher Pfohl](https://github.com/Crisfole), [Jean-Cédric Huet](https://github.com/BiscuiTech), [Johan Karlsson](https://github.com/JouanDeag), [Oscar Beaumont](https://github.com/oscartbeaumont), [Parables Boltnoel](https://github.com/Parables), [CA Gustavo](https://github.com/gustavocadev), [Zach](https://github.com/zach-hopkins), [Boian Ivanov](https://github.com/boian-ivanov), [Fabian Merino](https://github.com/fabianmerino), [Jasper Kelder](https://github.com/JasperKelder), [Jeremy Schoonover](https://github.com/skoontastic), [Jordan Calhoun](https://github.com/jordancalhoun), [Kelby Faessler](https://github.com/kelbyfaessler), [Lih Haur Voon](https://github.com/leovoon), [Marvin](https://github.com/m4rvr), [Mathis Côté](https://github.com/BenocxX), [Oskar](https://github.com/oskar-gmerek), [Roga](https://github.com/rogadev),[Thomas Slater](https://github.com/taslater), [VoiceOfSoftware](https://github.com/VoiceOfSoftware), [hffeka](https://github.com/hffeka), [moka-ayumu](https://github.com/moka-ayumu), [weepy](https://github.com/weepy)

**Ready to update? Read the [migration guide!](https://lucia-auth.com/start-here/migrate-to-version-1)**
**Ready to update? Read the [migration guide!](https://lucia-auth.com/migrate-to-version-1)**
2 changes: 1 addition & 1 deletion documentation/content/blog/lucia-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We're super excited to announce Lucia 2.0!

This update brings new big features to the library as well as major improvements to our APIs. A big focus for 2.0 was bringing stability, and that included future proofing it. This should mean 2.0 marks the end of our "rapid development" stage.

There is unfortunately a slew of breaking changes, but it shouldn't take more than 20 minutes for most users. At worst, it should only take an hour or so. Please read the [migration guide](/start-here/migrate-v2) for details. And, if you encounter any issues, feel free to ask them on our Discord server!
There is unfortunately a slew of breaking changes, but it shouldn't take more than 20 minutes for most users. At worst, it should only take an hour or so. Please read the [migration guide](/migrate/v2) for details. And, if you encounter any issues, feel free to ask them on our Discord server!

You might've noticed that we updated our docs (again)! Some key features are still missing (namely dark mode and search) but it should be just better all around. We also added the [Guidebook](/guidebook). This is a collection of tutorials and guides on using Lucia, and it should cover the lack of resources compared to other solutions. It's still a work-in-progress and expect more content soon!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: "Email authentication with verification links in Express"
menuTitle: "Express"
description: "Extend Lucia by implementing email and password authentication with email verification links"
---

_Before starting, make sure you've [setup Lucia and your database](/start-here/getting-started)._
_Before starting, make sure you've [setup Lucia and your database](/getting-started)._

If you're new to Lucia, we recommend starting with [Sign in with username and password](/guidebook/sign-in-with-username-and-password/express) starter guide as this guide will gloss over basic concepts and APIs. Make sure to implement password resets as well, which is covered in a separate guide (see [Password reset links](/guidebook/password-reset-link/express) guide).

Expand Down Expand Up @@ -89,7 +88,7 @@ When a user clicks the link, we validate of the token stored in the url and set

### Create new tokens

`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).
`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/modules/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).

```ts
// token.ts
Expand Down Expand Up @@ -123,7 +122,7 @@ export const generateEmailVerificationToken = async (userId: string) => {

### Validate tokens

`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).
`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/modules/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).

It will throw if the token is invalid.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: "Email authentication with verification links in Next.js App Router"
menuTitle: "Next.js App Router"
description: "Extend Lucia by implementing email and password authentication with email verification links"
---

_Before starting, make sure you've [setup Lucia and your database](/start-here/getting-started)._
_Before starting, make sure you've [setup Lucia and your database](/getting-started)._

If you're new to Lucia, we recommend starting with [Sign in with username and password](/guidebook/sign-in-with-username-and-password/nextjs-app) starter guide as this guide will gloss over basic concepts and APIs. Make sure to implement password resets as well, which is covered in a separate guide (see [Password reset links](/guidebook/password-reset-link/nextjs-app) guide).

Expand Down Expand Up @@ -100,7 +99,7 @@ When a user clicks the link, we validate of the token stored in the url and set

### Create new tokens

`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).
`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/modules/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).

```ts
// auth/token.ts
Expand Down Expand Up @@ -134,7 +133,7 @@ export const generateEmailVerificationToken = async (userId: string) => {

### Validate tokens

`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).
`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/modules/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).

It will throw if the token is invalid.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: "Email authentication with verification links in Next.js Pages Router"
menuTitle: "Next.js Pages Router"
description: "Extend Lucia by implementing email and password authentication with email verification links"
---

_Before starting, make sure you've [setup Lucia and your database](/start-here/getting-started)._
_Before starting, make sure you've [setup Lucia and your database](/getting-started)._

If you're new to Lucia, we recommend starting with [Sign in with username and password](/guidebook/sign-in-with-username-and-password/nextjs-pages) starter guide as this guide will gloss over basic concepts and APIs. Make sure to implement password resets as well, which is covered in a separate guide (see [Password reset links](/guidebook/password-reset-link/nextjs-pages) guide).

Expand Down Expand Up @@ -97,7 +96,7 @@ When a user clicks the link, we validate of the token stored in the url and set

### Create new tokens

`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).
`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/modules/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).

```ts
// auth/token.ts
Expand Down Expand Up @@ -131,7 +130,7 @@ export const generateEmailVerificationToken = async (userId: string) => {

### Validate tokens

`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).
`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/modules/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).

It will throw if the token is invalid.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: "Email authentication with verification links in Nuxt"
menuTitle: "Nuxt"
description: "Extend Lucia by implementing email and password authentication with email verification links"
---

_Before starting, make sure you've [setup Lucia and your database](/start-here/getting-started)._
_Before starting, make sure you've [setup Lucia and your database](/getting-started)._

If you're new to Lucia, we recommend starting with [Sign in with username and password](/guidebook/sign-in-with-username-and-password/nuxt) starter guide as this guide will gloss over basic concepts and APIs. Make sure to implement password resets as well, which is covered in a separate guide (see [Password reset links](/guidebook/password-reset-link/nuxt) guide).

Expand Down Expand Up @@ -97,7 +96,7 @@ When a user clicks the link, we validate of the token stored in the url and set

### Create new tokens

`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).
`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/modules/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).

```ts
// server/utils/token.ts
Expand Down Expand Up @@ -131,7 +130,7 @@ export const generateEmailVerificationToken = async (userId: string) => {

### Validate tokens

`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).
`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/modules/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).

It will throw if the token is invalid.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: "Email authentication with verification links in SvelteKit"
menuTitle: "SvelteKit"
description: "Extend Lucia by implementing email and password authentication with email verification links"
---

_Before starting, make sure you've [setup Lucia and your database](/start-here/getting-started/sveltekit)._
_Before starting, make sure you've [setup Lucia and your database](/getting-started/sveltekit)._

If you're new to Lucia, we recommend starting with [Sign in with username and password](/guidebook/sign-in-with-username-and-password/sveltekit) starter guide as this guide will gloss over basic concepts and APIs. Make sure to implement password resets as well, which is covered in a separate guide (see [Password reset links](/guidebook/password-reset-link/sveltekit) guide).

Expand Down Expand Up @@ -98,7 +97,7 @@ When a user clicks the link, we validate of the token stored in the url and set

### Create new tokens

`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).
`generateEmailVerificationToken()` will first check if a verification token already exists for the user. If it does, it will re-use the token if the expiration is over 1 hour away (half the expiration of 2 hours). If not, it will create a new token using [`generateRandomString()`](/reference/lucia/modules/utils#generaterandomstring) with a length of 63. The length is arbitrary, and anything around or longer than 64 characters should be sufficient (recommend minimum is 40).

```ts
// lib/server/token.ts
Expand Down Expand Up @@ -132,7 +131,7 @@ export const generateEmailVerificationToken = async (userId: string) => {

### Validate tokens

`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).
`validateEmailVerificationToken()` will get the token and delete all tokens belonging to the user (which includes the used token). We recommend handling this in a transaction or a batched query. It thens check the expiration with [`isWithinExpiration()`](/reference/lucia/modules/utils#iswithinexpiration), provided by Lucia, which checks if the current time is within the provided expiration time (in milliseconds).

It will throw if the token is invalid.

Expand Down
Loading

0 comments on commit 10019b4

Please sign in to comment.