fix: #11729, only check registered users

ignore guests(uid 0) & spiders(uid -1)
isekai-main
Barış Soner Uşaklı 2 years ago
parent 4e146eb50b
commit 090a792168

@ -239,7 +239,7 @@ module.exports = function (middleware) {
*/ */
const path = req.path.startsWith('/api/') ? req.path.replace('/api', '') : req.path; const path = req.path.startsWith('/api/') ? req.path.replace('/api', '') : req.path;
if (req.uid && !(path.endsWith('/edit/email') || path.startsWith('/confirm/'))) { if (req.uid > 0 && !(path.endsWith('/edit/email') || path.startsWith('/confirm/'))) {
const [confirmed, isAdmin] = await Promise.all([ const [confirmed, isAdmin] = await Promise.all([
user.getUserField(req.uid, 'email:confirmed'), user.getUserField(req.uid, 'email:confirmed'),
user.isAdministrator(req.uid), user.isAdministrator(req.uid),

Loading…
Cancel
Save