Skip to content

Commit fe81153

Browse files
committed
refactor: remove "password" in comments
1 parent e532dcb commit fe81153

File tree

8 files changed

+5
-16
lines changed

8 files changed

+5
-16
lines changed

src/api/users.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ usersAPI.update = async function (caller, data) {
6767
privileges.users.canEdit(caller.uid, data.uid),
6868
]);
6969

70-
// Changing own email/username requires password confirmation
71-
if (data.hasOwnProperty('email') || data.hasOwnProperty('username')) {
70+
const isChangingEmailOrUsername = data.hasOwnProperty('email') || data.hasOwnProperty('username');
71+
if (isChangingEmailOrUsername) {
7272
await isPrivilegedOrSelfAndPasswordMatch(caller, data);
7373
}
7474

@@ -547,7 +547,6 @@ async function processDeletion({ uid, method, password, caller }) {
547547
throw new Error('[[error:no-privileges]]');
548548
}
549549

550-
// Self-deletions require a password
551550
const hasPassword = await user.hasPassword(uid);
552551
if (isSelf && hasPassword) {
553552
const ok = await user.isPasswordCorrect(uid, password, caller.ip);

src/cli/setup.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ async function setup(initConfig) {
5151
}
5252
console.log('NodeBB Setup Completed. Run "./nodebb start" to manually start your NodeBB server.');
5353

54-
// If I am a child process, notify the parent of the returned data before exiting (useful for notifying
55-
// hosts of auto-generated username/password during headless setups)
54+
// If I am a child process, notify the parent of the returned data before exiting (useful for notifying hosts during headless setups)
5655
if (process.send) {
5756
process.send(data);
5857
}

src/install.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,21 @@ async function createAdmin() {
370370
}
371371

372372
async function retryPassword(originalResults) {
373-
// Ask only the password questions
374373
const results = await prompt.get(passwordQuestions);
375374

376-
// Update the original data with newly collected password
377375
originalResults.password = results.password;
378376
originalResults['password:confirm'] = results['password:confirm'];
379377

380-
// Send back to success to handle
381378
return await success(originalResults);
382379
}
383380

384-
// Add the password questions
385381
questions = questions.concat(passwordQuestions);
386382

387383
if (!install.values) {
388384
const results = await prompt.get(questions);
389385
return await success(results);
390386
}
391-
// If automated setup did not provide a user password, generate one,
392-
// it will be shown to the user upon setup completion
387+
393388
if (!install.values.hasOwnProperty('admin:password') && !nconf.get('admin:password')) {
394389
console.log('Password was not provided during automated setup, generating one...');
395390
password = utils.generateUUID().slice(0, 8);

src/middleware/admin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ middleware.checkPrivileges = helpers.try(async (req, res, next) => {
4747
}
4848
}
4949

50-
// If user does not have password
5150
const hasPassword = await user.hasPassword(req.uid);
5251
if (!hasPassword) {
5352
return next();

src/socket.io/user.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ require('./user/status')(SocketUser);
2424
require('./user/picture')(SocketUser);
2525
require('./user/registration')(SocketUser);
2626

27-
// Password Reset
2827
SocketUser.reset = {};
2928

3029
SocketUser.reset.send = async function (socket, email) {

src/user/data.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ module.exports = function (User) {
8282
if (!fields.length) {
8383
fields = results.whitelist;
8484
} else {
85-
// Never allow password retrieval via this method
8685
fields = fields.filter(value => value !== 'password');
8786
}
8887

src/user/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ User.addInterstitials = function (callback) {
244244
plugins.hooks.register('core', {
245245
hook: 'filter:register.interstitial',
246246
method: [
247-
User.interstitials.email, // Email address (for password reset + digest)
247+
User.interstitials.email, // Email address
248248
User.interstitials.gdpr, // GDPR information collection/processing consent + email consent
249249
User.interstitials.tou, // Forum Terms of Use
250250
],

src/user/reset.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ UserReset.commit = async function (code, password) {
108108
'password:shaWrapped': 1,
109109
};
110110

111-
// don't verify email if password reset is due to expiry
112111
const isPasswordExpired = userData.passwordExpiry && userData.passwordExpiry < Date.now();
113112
if (!isPasswordExpired) {
114113
data['email:confirmed'] = 1;

0 commit comments

Comments
 (0)