Add support for message history pagination, preserve scroll in rendering, and improve draft/message workflows.
This commit is contained in:
@@ -5,6 +5,7 @@ import express from "express";
|
||||
import {asyncHandler} from "../middleware/asyncHandler.js";
|
||||
import bcrypt from "bcrypt";
|
||||
import {validateBody} from "../middleware/validate.js";
|
||||
import {newPasswordError} from "../services/passwordPolicy.js";
|
||||
|
||||
const credentialsValidator = (body) => {
|
||||
const username = String(body?.username || "").trim();
|
||||
@@ -22,6 +23,8 @@ export function createAuthRouter({repositories, authRateLimiters, config}) {
|
||||
|
||||
router.post("/register", ...authRateLimiters, validateBody(credentialsValidator), asyncHandler(async (req, res) => {
|
||||
const {username, password, inviteCode} = req.validatedBody;
|
||||
const passwordError = newPasswordError(password);
|
||||
if (passwordError) return res.status(400).json({error: passwordError, code: "PASSWORD_TOO_LONG"});
|
||||
if (config.registrationInviteCode && inviteCode !== config.registrationInviteCode) {
|
||||
return res.status(403).json({error: "Valid invite code is required"});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user