feat: add password change, class unenroll, and optional notify flags

Let admins skip SMS on user, class, and invoice actions, and let users change their own password with the current one.
This commit is contained in:
2026-08-15 23:48:18 +03:30
parent 0cdb9cec20
commit 192c595c68
16 changed files with 289 additions and 60 deletions
+4 -1
View File
@@ -11,6 +11,7 @@ const { generateUsername, generateSimplePassword } = require('../../utils/creden
const { sendAccountCreatedSms } = require('../../utils/senders/smsMessages');
const logger = require('../../utils/logger');
const { mergeFullName, normalizeGender } = require('../../utils/userProfile');
const { pickNotifyFlags } = require('../../utils/notifyFlags');
const normalizeAdminNotes = (value) => {
if (value == null) return undefined;
@@ -175,7 +176,9 @@ const createUserAdmin = async (body) => {
});
try {
await sendAccountCreatedSms(profile.phoneNumber, username, plainPassword, user._id);
if (pickNotifyFlags(body).sms) {
await sendAccountCreatedSms(profile.phoneNumber, username, plainPassword, user._id);
}
} catch (err) {
logger.error(`[createUserAdmin] Account SMS failed for ${profile.phoneNumber}: ${err.message}`);
}