mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 22:09:16 +01:00
Add public timeline
This commit is contained in:
parent
bff170d2e2
commit
b7587f8d3f
9 changed files with 158 additions and 7 deletions
|
|
@ -12,7 +12,7 @@ export default async (
|
|||
req: Request,
|
||||
matchedRoute: MatchedRoute
|
||||
): Promise<Response> => {
|
||||
const scopes = (matchedRoute.query.scopes || "")
|
||||
const scopes = (matchedRoute.query.scope || "")
|
||||
.replaceAll("+", " ")
|
||||
.split(" ");
|
||||
const redirect_uri = matchedRoute.query.redirect_uri;
|
||||
|
|
@ -21,18 +21,18 @@ export default async (
|
|||
|
||||
const formData = await req.formData();
|
||||
|
||||
const username = formData.get("username")?.toString() || null;
|
||||
const email = formData.get("email")?.toString() || null;
|
||||
const password = formData.get("password")?.toString() || null;
|
||||
|
||||
if (response_type !== "code")
|
||||
return errorResponse("Invalid response type (try 'code')", 400);
|
||||
|
||||
if (!username || !password)
|
||||
if (!email || !password)
|
||||
return errorResponse("Missing username or password", 400);
|
||||
|
||||
// Get user
|
||||
const user = await User.findOneBy({
|
||||
username,
|
||||
email,
|
||||
});
|
||||
|
||||
if (!user || !(await Bun.password.verify(password, user.password)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue