diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index 78c9bfd50..07634b07d 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -760,24 +760,24 @@ class Mailbox(DatesAware): return True @staticmethod - def resolve_uid(value): + def resolve_id(value, idname, errmsg): if value.isdigit(): return value try: - uid = pwd.getpwnam(value).pw_uid + rid = getattr(pwd.getpwnam(value), idname) except KeyError: - raise AdminError(_("%s is not a valid uid/username" % value)) - return uid + raise AdminError(errmsg) + return rid + + @staticmethod + def resolve_uid(value): + err = _("%s is not a valid uid/username" % value) + return Mailbox.resolve_id(value, "pw_uid", err) @staticmethod def resolve_gid(value): - if value.isdigit(): - return value - try: - gid = pwd.getpwnam(value).pw_gid - except KeyError: - raise AdminError(_("%s is not a valid gid/groupname" % value)) - return gid + err = _("%s is not a valid gid/groupname" % value) + return Mailbox.resolve_id(value, "pw_gid", err) def set_ownership(self): """Set uid and gid for this mailbox diff --git a/modoboa/admin/templates/admin/parameters.html b/modoboa/admin/templates/admin/parameters.html index 3cbf6ac3e..ec810251c 100644 --- a/modoboa/admin/templates/admin/parameters.html +++ b/modoboa/admin/templates/admin/parameters.html @@ -1,7 +1,7 @@ -{% load i18n %} +{% load i18n %}{% load url from future %} {% url "modoboa.admin.views.saveparameters" as action %}

{% trans "Parameters" %} {% trans "Configure Modoboa" %}


-
+ {% include "common/parameters.html" %}

diff --git a/modoboa/static/js/twocols_nav.js b/modoboa/static/js/twocols_nav.js index f15c487a6..4975fee1c 100644 --- a/modoboa/static/js/twocols_nav.js +++ b/modoboa/static/js/twocols_nav.js @@ -33,10 +33,15 @@ TwocolsNav.prototype = { }, update_content: function(data) { - $('#' + this.options.divid).html(data.content); + if (data.content) { + $('#' + this.options.divid).html(data.content); + } if (data.onload_cb) { eval(data.onload_cb + '()'); } + if (data.respmsg) { + $("body").notify("error", data.respmsg); + } $('#' + this.options.divid + ' select').change($.proxy(this.select_change, this)); $(".help").popover().click(function(e) {e.preventDefault();}); $('#' + this.options.divid + ' select').change();