auth routes
This commit is contained in:
@@ -37,9 +37,20 @@ async function getToken(user: User) {
|
||||
return { token };
|
||||
}
|
||||
|
||||
// TODO: the response interface also returns settings, but this route doesn't actually return that.
|
||||
router.post(
|
||||
"/",
|
||||
route({ body: "VerifyEmailSchema" }),
|
||||
route({
|
||||
body: "VerifyEmailSchema",
|
||||
responses: {
|
||||
200: {
|
||||
body: "TokenResponse",
|
||||
},
|
||||
400: {
|
||||
body: "APIErrorOrCaptchaResponse",
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const { captcha_key, token } = req.body;
|
||||
|
||||
|
||||
@@ -24,7 +24,14 @@ const router = Router();
|
||||
|
||||
router.post(
|
||||
"/",
|
||||
route({ right: "RESEND_VERIFICATION_EMAIL" }),
|
||||
route({
|
||||
right: "RESEND_VERIFICATION_EMAIL",
|
||||
responses: {
|
||||
204: {},
|
||||
400: {},
|
||||
500: {},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const user = await User.findOneOrFail({
|
||||
where: { id: req.user_id },
|
||||
|
||||
@@ -16,15 +16,21 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@spacebar/api";
|
||||
import { FieldErrors, User, BackupCodesChallengeSchema } from "@spacebar/util";
|
||||
import { BackupCodesChallengeSchema, FieldErrors, User } from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { Request, Response, Router } from "express";
|
||||
const router = Router();
|
||||
|
||||
router.post(
|
||||
"/",
|
||||
route({ body: "BackupCodesChallengeSchema" }),
|
||||
route({
|
||||
body: "BackupCodesChallengeSchema",
|
||||
responses: {
|
||||
200: { body: "BackupCodesChallengeResponse" },
|
||||
400: { body: "APIErrorResponse" },
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const { password } = req.body as BackupCodesChallengeSchema;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user