From: Michael Tremer Date: Thu, 11 Oct 2018 11:06:33 +0000 (+0100) Subject: Actually deliver a default avatar when none was uploaded X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c740fe4046dce8621fcf98a4eab0d671f6e47f5e;p=ipfire.org.git Actually deliver a default avatar when none was uploaded Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 3c5a1a7e..a6a7a264 100644 --- a/Makefile.am +++ b/Makefile.am @@ -220,6 +220,7 @@ static_images_DATA = \ src/static/img/amex@2x.png \ src/static/img/amex@3x.png \ src/static/img/appliance-pro.png \ + src/static/img/default-avatar.jpg \ src/static/img/ipfire-tux.png \ src/static/img/lightningwirelabs-logo.svg \ src/static/img/mastercard.png \ diff --git a/src/static/img/default-avatar.jpg b/src/static/img/default-avatar.jpg new file mode 100644 index 00000000..07ffd9fc Binary files /dev/null and b/src/static/img/default-avatar.jpg differ diff --git a/src/web/handlers_accounts.py b/src/web/handlers_accounts.py index bbf113e2..1560eee6 100644 --- a/src/web/handlers_accounts.py +++ b/src/web/handlers_accounts.py @@ -30,7 +30,7 @@ class AccountsAvatarHandler(base.BaseHandler): # If there is no avatar, we serve a default image if not avatar: - raise tornado.web.HTTPError(404, "No avatar set for %s" % account) + return self.redirect("https://static.ipfire.org%s" % self.static_url("img/default-avatar.jpg")) # Set headers about content self.set_header("Content-Disposition", "inline; filename=\"%s.jpg\"" % who)