upd
This commit is contained in:
@@ -8,13 +8,16 @@ import { createSecretKey } from "crypto";
|
||||
const router = Router();
|
||||
|
||||
router.post("/", async (req, res) => {
|
||||
const { username, password } = req.body;
|
||||
const username = req.body.username.toLowerCase().trim();
|
||||
const { password } = req.body;
|
||||
|
||||
if (!username || !password) {
|
||||
return res.json({ error: "Неверный логин или пароль" });
|
||||
}
|
||||
|
||||
const user = await User.findOne({ username }).lean();
|
||||
const user = await User.findOne({
|
||||
username: { $regex: new RegExp(username, "i") },
|
||||
}).lean();
|
||||
|
||||
if (!user) {
|
||||
return res.json({ error: "Неверный логин или пароль" });
|
||||
|
||||
Reference in New Issue
Block a user