mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
refactor: how admins change emails (#11973)
* refactor: how admins change emails ability for admins to change emails from acp ability for admins to change passwords from acp only users themselves can use /user/<slug>/edit/email group actions in manage users dropdown admins can use the same modal from profile page instead of interstitial to update email add missing checks to addEmail, if email take throw error add targetUid to email change event * test: bunch of baloney * test: remove old test
This commit is contained in:
committed by
GitHub
parent
6ae0d207a7
commit
8db13d8e86
@@ -90,16 +90,7 @@ editController.username = async function (req, res, next) {
|
||||
|
||||
editController.email = async function (req, res, next) {
|
||||
const targetUid = await user.getUidByUserslug(req.params.userslug);
|
||||
if (!targetUid) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const [isAdminOrGlobalMod, canEdit] = await Promise.all([
|
||||
user.isAdminOrGlobalMod(req.uid),
|
||||
privileges.users.canEdit(req.uid, targetUid),
|
||||
]);
|
||||
|
||||
if (!isAdminOrGlobalMod && !canEdit) {
|
||||
if (!targetUid || req.uid !== parseInt(targetUid, 10)) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user