Skip to content

Commit

Permalink
Docs: Fix userId assignment (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trugamr authored Sep 5, 2023
1 parent 706c1d9 commit 72626ba
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ post("/login", async (request: Request) => {
// and validate password
const key = await auth.useKey("email", email.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const sessionCookie = auth.createSessionCookie(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ app.post("/login", async (req, res) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const authRequest = auth.handleRequest(req, res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ app.post("/login", async (context) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const authRequest = auth.handleRequest(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export const POST = async (request: NextRequest) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const authRequest = auth.handleRequest({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const authRequest = auth.handleRequest({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export default defineEventHandler(async (event) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const authRequest = auth.handleRequest(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ post("/login", async (request: Request) => {
// and validate password
const key = await auth.useKey("username", username.toLowerCase(), password);
const session = await auth.createSession({
userId: user.userId,
userId: key.userId,
attributes: {}
});
const sessionCookie = auth.createSessionCookie(session);
Expand Down

0 comments on commit 72626ba

Please sign in to comment.