Add script nonce for Multiuser notification script inject

This commit is contained in:
shortcutme 2018-11-26 00:18:46 +01:00
parent 0882f9dd3c
commit dace0671c2
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -62,7 +62,7 @@ class UiRequestPlugin(object):
back = back_generator.next() back = back_generator.next()
inject_html = """ inject_html = """
<!-- Multiser plugin --> <!-- Multiser plugin -->
<script> <script nonce="{script_nonce}">
setTimeout(function() { setTimeout(function() {
zeroframe.cmd("wrapperNotification", ["done", "{message}<br><small>You have been logged in successfully</small>", 5000]) zeroframe.cmd("wrapperNotification", ["done", "{message}<br><small>You have been logged in successfully</small>", 5000])
}, 1000) }, 1000)
@ -75,6 +75,7 @@ class UiRequestPlugin(object):
else: else:
message = "Hello again!" message = "Hello again!"
inject_html = inject_html.replace("{message}", message) inject_html = inject_html.replace("{message}", message)
inject_html = inject_html.replace("{script_nonce}", self.getScriptNonce())
return iter([re.sub("</body>\s*</html>\s*$", inject_html, back)]) # Replace the </body></html> tags with the injection return iter([re.sub("</body>\s*</html>\s*$", inject_html, back)]) # Replace the </body></html> tags with the injection
else: # No injection necessary else: # No injection necessary