mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-03 22:30:58 +01:00
Locks bug failing test (#9595)
* test: failing test for issue * fix: #9593, don't lock if email is identical to username * fix: lock calls after first call * fix: add back email check * test: remove invalid test Co-authored-by: Julian Lam <julian@nodebb.org>
This commit is contained in:
committed by
GitHub
parent
9f74caf65c
commit
ca72aa93d7
@@ -19,14 +19,14 @@ module.exports = function (User) {
|
||||
data.email = String(data.email).trim();
|
||||
}
|
||||
|
||||
await User.isDataValid(data);
|
||||
|
||||
await lock(data.username, '[[error:username-taken]]');
|
||||
if (data.email && data.email !== data.username) {
|
||||
await lock(data.email, '[[error:email-taken]]');
|
||||
}
|
||||
|
||||
try {
|
||||
await lock(data.username, '[[error:username-taken]]');
|
||||
if (data.email) {
|
||||
await lock(data.email, '[[error:email-taken]]');
|
||||
}
|
||||
|
||||
await User.isDataValid(data);
|
||||
|
||||
return await create(data);
|
||||
} finally {
|
||||
await db.deleteObjectFields('locks', [data.username, data.email]);
|
||||
|
||||
Reference in New Issue
Block a user