Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,32 @@
import { UserPendings, UserProfiles } from "../../../models/index.js";
import { signup } from "../common/signup.js";
import signin from "../common/signin.js";
export default (async (ctx)=>{
const body = ctx.request.body;
const code = body["code"];
try {
const pendingUser = await UserPendings.findOneByOrFail({
code
});
const { account, secret } = await signup({
username: pendingUser.username,
passwordHash: pendingUser.password
});
UserPendings.delete({
id: pendingUser.id
});
const profile = await UserProfiles.findOneByOrFail({
userId: account.id
});
await UserProfiles.update({
userId: profile.userId
}, {
email: pendingUser.email,
emailVerified: true,
emailVerifyCode: null
});
signin(ctx, account);
} catch (e) {
ctx.throw(400, e);
}
});