Skip to content

Commit ec93976

Browse files
authored
chore(docs): pnpm format (#11120)
chore: `pnpm format`
1 parent 24b0e66 commit ec93976

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

docs/pages/getting-started/authentication/credentials.mdx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -106,43 +106,46 @@ export { handle } from "./auth"
106106
<Code.Express>
107107

108108
```ts filename="./src/routes/auth.route.ts" {2, 11}
109-
import { ExpressAuth } from '@auth/express'
110-
import Credentials from '@auth/express/providers/credentials'
109+
import { ExpressAuth } from "@auth/express"
110+
import Credentials from "@auth/express/providers/credentials"
111111
import express from "express"
112112
// Your own logic for dealing with plaintext password strings; be careful!
113113
import { saltAndHashPassword } from "@/utils/password"
114114

115115
const app = express()
116-
app.use("/auth/*", ExpressAuth({
117-
providers: [
118-
Credentials({
119-
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
120-
// e.g. domain, username, password, 2FA token, etc.
121-
credentials: {
122-
email: {},
123-
password: {},
124-
},
125-
authorize: async (credentials) => {
126-
let user = null
116+
app.use(
117+
"/auth/*",
118+
ExpressAuth({
119+
providers: [
120+
Credentials({
121+
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
122+
// e.g. domain, username, password, 2FA token, etc.
123+
credentials: {
124+
email: {},
125+
password: {},
126+
},
127+
authorize: async (credentials) => {
128+
let user = null
127129

128-
// logic to salt and hash password
129-
const pwHash = saltAndHashPassword(credentials.password)
130+
// logic to salt and hash password
131+
const pwHash = saltAndHashPassword(credentials.password)
130132

131-
// logic to verify if user exists
132-
user = await getUserFromDb(credentials.email, pwHash)
133+
// logic to verify if user exists
134+
user = await getUserFromDb(credentials.email, pwHash)
133135

134-
if (!user) {
135-
// No user found, so this is their first attempt to login
136-
// meaning this is also the place you could do registration
137-
throw new Error("User not found.")
138-
}
136+
if (!user) {
137+
// No user found, so this is their first attempt to login
138+
// meaning this is also the place you could do registration
139+
throw new Error("User not found.")
140+
}
139141

140-
// return user object with the their profile data
141-
return user
142-
},
143-
}),
144-
],
145-
}))
142+
// return user object with the their profile data
143+
return user
144+
},
145+
}),
146+
],
147+
})
148+
)
146149
```
147150

148151
</Code.Express>

0 commit comments

Comments
 (0)