mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Fixed XSS issue in domain creation form.
This commit is contained in:
@@ -295,7 +295,7 @@ Domains.prototype = {
|
||||
|
||||
optionsform_prefill: function() {
|
||||
var $span = $("#id_dom_admin_username").next("span");
|
||||
$span.html("@" + $("#id_name").val());
|
||||
$span.html("@" + htmlEncode($("#id_name").val()));
|
||||
},
|
||||
|
||||
domadminsform_init: function() {
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
{{ block.super }}
|
||||
<script src="{% static 'transport/js/transport.js' %}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
admin = new Domains({
|
||||
load_page_url: "{% url 'admin:domain_page' %}"
|
||||
});
|
||||
});
|
||||
$(document).ready(function() {
|
||||
admin = new Domains({
|
||||
load_page_url: "{% url 'admin:domain_page' %}"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% extra_static_content "domains" "js" user %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -361,6 +361,15 @@ String.prototype.format = function() {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple HTML escape function
|
||||
*/
|
||||
function htmlEncode(str) {
|
||||
return String(str).replace(/[^\w. ]/gi, function(c) {
|
||||
return '&#'+c.charCodeAt(0)+';';
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ajaxSuccess(function(e, xhr, settings) { ajax_login_redirect(xhr); });
|
||||
$(document).ajaxError(defaultAjaxErrorHandler);
|
||||
|
||||
Reference in New Issue
Block a user