-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Rajat Saxena <hi@rajatsaxena.dev>
- Loading branch information
1 parent
752e149
commit 38350f0
Showing
37 changed files
with
582 additions
and
214 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+130 KB
.yarn/cache/preact-render-to-string-npm-5.2.6-5999db0763-be8d5d8fb5.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { NextApiResponse } from "next"; | ||
import { getServerSession } from "next-auth"; | ||
import ApiRequest from "../models/ApiRequest"; | ||
import User from "../models/User"; | ||
import { authOptions } from "../pages/api/auth/[...nextauth]"; | ||
|
||
export default async function setUserFromSession( | ||
req: ApiRequest, | ||
res: NextApiResponse, | ||
next: any, | ||
): Promise<void> { | ||
const session = await getServerSession(req, res, authOptions); | ||
|
||
if (session) { | ||
try { | ||
const user = await User.findOne({ | ||
email: session.user.email, | ||
domain: req.subdomain._id, | ||
active: true, | ||
}); | ||
if (user) { | ||
req.user = user; | ||
} | ||
} catch (e: any) { | ||
next(); | ||
} | ||
} | ||
|
||
next(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import mongoose from "mongoose"; | ||
|
||
export interface VerificationToken { | ||
_id: mongoose.Types.ObjectId; | ||
email: string; | ||
domain: string; | ||
code: string; | ||
timestamp: Date; | ||
} | ||
|
||
const VerificationTokenSchema = new mongoose.Schema<VerificationToken>({ | ||
email: { type: String, required: true }, | ||
domain: { type: String, required: true }, | ||
code: { type: String, required: true }, | ||
timestamp: { type: Date, required: true }, | ||
}); | ||
|
||
VerificationTokenSchema.index( | ||
{ | ||
email: 1, | ||
domain: 1, | ||
code: 1, | ||
}, | ||
{ unique: true }, | ||
); | ||
|
||
export default mongoose.models.VerificationToken || | ||
mongoose.model("VerificationToken", VerificationTokenSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
38350f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
courselit – ./
*.clqa.xyz
courselit-codelit.vercel.app
courselit-git-main-codelit.vercel.app