mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: one more test
This commit is contained in:
10
test/user.js
10
test/user.js
@@ -850,6 +850,16 @@ describe('User', function () {
|
|||||||
assert.equal(err.message, '[[user:change_password_error_privileges]]');
|
assert.equal(err.message, '[[user:change_password_error_privileges]]');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should let admin change another users password', async function () {
|
||||||
|
const adminUid = await User.create({ username: 'adminpwdchange2', password: 'admin1234' });
|
||||||
|
await groups.join('administrators', adminUid);
|
||||||
|
const uid = await User.create({ username: 'forgotmypassword', password: '123456' });
|
||||||
|
|
||||||
|
await socketUser.changePassword({ uid: adminUid }, { uid: uid, newPassword: '654321' });
|
||||||
|
const correct = await User.isPasswordCorrect(uid, '654321', '127.0.0.1');
|
||||||
|
assert(correct);
|
||||||
|
});
|
||||||
|
|
||||||
it('should change username', function (done) {
|
it('should change username', function (done) {
|
||||||
socketUser.changeUsernameEmail({ uid: uid }, { uid: uid, username: 'updatedAgain', password: '123456' }, function (err) {
|
socketUser.changeUsernameEmail({ uid: uid }, { uid: uid, username: 'updatedAgain', password: '123456' }, function (err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user