Password notification fix

Updated `gam create|update user ... notify` to encode the characters `<>&` in the password
so that they display correctly when the notify message content is HTML.
This commit is contained in:
Ross Scroggs
2024-01-15 09:31:05 -08:00
parent cc50ae28cd
commit 647da9f980
5 changed files with 25 additions and 12 deletions

View File

@@ -2,6 +2,11 @@
Merged GAM-Team version
6.67.19
Updated `gam create|update user ... notify` to encode the characters `<>&` in the password
so that they display correctly when the notify message content is HTML.
6.67.18
Cleaned up `Getting/Got` messages for `gam print courses|course-participants`.

View File

@@ -14357,8 +14357,11 @@ def sendCreateUpdateUserNotification(body, basenotify, tagReplacements, i=0, cou
notify[field] = notify[field].replace('#givenname#', body['name'].get('givenName', ''))
notify[field] = notify[field].replace('#familyname#', body['name'].get('familyName', ''))
def _makePasswordSubstitutions(field):
notify[field] = notify[field].replace('#password#', notify['password'])
def _makePasswordSubstitutions(field, html):
if not html:
notify[field] = notify[field].replace('#password#', notify['password'])
else:
notify[field] = notify[field].replace('#password#', notify['password']).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
userName, domain = splitEmailAddress(body['primaryEmail'])
notify = basenotify.copy()
@@ -14376,8 +14379,8 @@ def sendCreateUpdateUserNotification(body, basenotify, tagReplacements, i=0, cou
_getTagReplacementFieldValues(body['primaryEmail'], i, count, tagReplacements, body if createMessage else None)
notify['subject'] = _processTagReplacements(tagReplacements, notify['subject'])
notify['message'] = _processTagReplacements(tagReplacements, notify['message'])
_makePasswordSubstitutions('subject')
_makePasswordSubstitutions('message')
_makePasswordSubstitutions('subject', False)
_makePasswordSubstitutions('message', notify['html'])
if 'from' in notify:
msgFrom = notify['from']
msgReplyTo = notify.get('replyto', None)