From 8e1d49850189235dfd898a2ab5620d343397fc8a Mon Sep 17 00:00:00 2001 From: Tristan Le Guern Date: Fri, 1 Mar 2019 00:25:28 +0000 Subject: [PATCH 01/27] Implement HTTP OPTIONS request on /avatar Returns the list of allowed values for the default option. --- ivatar/urls.py | 1 + ivatar/views.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ivatar/urls.py b/ivatar/urls.py index 1609c9f..a7a4870 100644 --- a/ivatar/urls.py +++ b/ivatar/urls.py @@ -21,6 +21,7 @@ urlpatterns = [ # pylint: disable=invalid-name url( r'avatar/(?P\w{32})', AvatarImageView.as_view(), name='avatar_view'), + url(r'avatar/$', AvatarImageView.as_view(), name='avatar_view'), url( r'avatar/(?P\w*)', TemplateView.as_view( diff --git a/ivatar/views.py b/ivatar/views.py index a50b571..3564e62 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -58,6 +58,11 @@ class AvatarImageView(TemplateView): ''' # TODO: Do cache resize images!! Memcached? + def options(self, request, *args, **kwargs): # pylint: disable=too-many-branches,too-many-statements,too-many-locals,too-many-return-statements + response = HttpResponse("", content_type='text/plain') + response['Allow'] = "404 mm mp retro pagan wavatar monsterid robohash identicon" + return response + def get(self, request, *args, **kwargs): # pylint: disable=too-many-branches,too-many-statements,too-many-locals,too-many-return-statements ''' Override get from parent class From 0c074f255b0fea55b2e6bd5891911f05ec04c7ac Mon Sep 17 00:00:00 2001 From: Niklas Poslovski Date: Sun, 3 Mar 2019 22:31:12 +0100 Subject: [PATCH 02/27] Add link to Mastodon profile. rel="me" attribute is required for link verification on Mastodon. --- templates/home.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/home.html b/templates/home.html index d517b0e..41cd8e1 100644 --- a/templates/home.html +++ b/templates/home.html @@ -71,6 +71,7 @@ {% trans 'Wiki' %}
{% trans 'Blog' %}

{% trans 'Social media' %}

+Mastodon Identica
Twitter
From 33bebba4236b685f098492b1f5f1f64087afd374 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Mon, 4 Mar 2019 11:23:28 +0100 Subject: [PATCH 03/27] Make all panels the same size --- ivatar/tools/templates/check.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivatar/tools/templates/check.html b/ivatar/tools/templates/check.html index 9e86eb4..9e80266 100644 --- a/ivatar/tools/templates/check.html +++ b/ivatar/tools/templates/check.html @@ -21,7 +21,7 @@
{% if mailurl %} -
+

MD5  

@@ -44,7 +44,7 @@ {% endif %} {% if openidurl %} -
+

SHA256  

From 88ddbe928b28ffc59b6fcf90401950fdf2cae073 Mon Sep 17 00:00:00 2001 From: Niklas Poslovski Date: Mon, 4 Mar 2019 12:16:05 +0100 Subject: [PATCH 04/27] Add line break after Mastodon link --- templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/home.html b/templates/home.html index 41cd8e1..484c32e 100644 --- a/templates/home.html +++ b/templates/home.html @@ -71,7 +71,7 @@ {% trans 'Wiki' %}
{% trans 'Blog' %}

{% trans 'Social media' %}

-Mastodon +Mastodon
Identica
Twitter
From d5011d76b5b3cef57d95a1b4e8aff7bd40605808 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 11:46:05 +0100 Subject: [PATCH 05/27] Better style README --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index e2ea9a9..431d07e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,21 @@ +ivatar / libravatar +=================== + +Pipeline and coverage status +============================ + [![pipeline status](https://git.linux-kernel.at/oliver/ivatar/badges/master/pipeline.svg)](https://git.linux-kernel.at/oliver/ivatar/commits/master) [![coverage report](https://git.linux-kernel.at/oliver/ivatar/badges/master/coverage.svg)](http://git.linux-kernel.at/oliver/ivatar/commits/master) +Reports / code documentation +============================ + - [Coverage HTML report](http://oliver.git.linux-kernel.at/ivatar) - [Code documentation (autogenerated, pycco)](http://oliver.git.linux-kernel.at/ivatar/pycco/) + +Authors and contributors +======================== + +Initial developer: François Marier - https://fmarier.org/ + +Lead developer/Owner: Oliver Falk - https://git.linux-kernel.at/oliver From 3a914c218ad300e4c340350afe0df21d696b61f1 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 11:57:12 +0100 Subject: [PATCH 06/27] Better style README and add a few names --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 431d07e..20995ca 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Reports / code documentation Authors and contributors ======================== -Initial developer: François Marier - https://fmarier.org/ +Lead developer/Owner: Oliver Falk (aka ofalk or falko) - https://git.linux-kernel.at/oliver +Operations: Michal Novotny (aka clime) +QA: Tristan Le Guern (aka tleguern) +Frontend developer: Niklas Poslovski (aka nipos) +Organisation/Meeting moderation: Lars Kruse (aka sumpfralle) -Lead developer/Owner: Oliver Falk - https://git.linux-kernel.at/oliver +Initial developer: François Marier - https://fmarier.org/ From bb5358a267d800893fc4a9fd3e1346b087a3f19b Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 12:29:50 +0100 Subject: [PATCH 07/27] Cache images (max-age=300) --- ivatar/views.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ivatar/views.py b/ivatar/views.py index b8850ad..6b7bc79 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -147,9 +147,11 @@ class AvatarImageView(TemplateView): data = BytesIO() monsterdata.save(data, 'PNG', quality=JPEG_QUALITY) data.seek(0) - return HttpResponse( + response = HttpResponse( data, content_type='image/png') + response['Cache-Control'] = 'max-age=300' + return response if str(default) == 'robohash': roboset = 'any' @@ -160,9 +162,11 @@ class AvatarImageView(TemplateView): data = BytesIO() robohash.img.save(data, format='png') data.seek(0) - return HttpResponse( + response = HttpResponse( data, content_type='image/png') + response['Cache-Control'] = 'max-age=300' + return response if str(default) == 'retro': identicon = Identicon.render(kwargs['digest']) @@ -171,9 +175,11 @@ class AvatarImageView(TemplateView): img = img.resize((size, size), Image.ANTIALIAS) img.save(data, 'PNG', quality=JPEG_QUALITY) data.seek(0) - return HttpResponse( + response = HttpResponse( data, content_type='image/png') + response['Cache-Control'] = 'max-age=300' + return response if str(default) == 'pagan': paganobj = pagan.Avatar(kwargs['digest']) @@ -181,9 +187,11 @@ class AvatarImageView(TemplateView): img = paganobj.img.resize((size, size), Image.ANTIALIAS) img.save(data, 'PNG', quality=JPEG_QUALITY) data.seek(0) - return HttpResponse( + response = HttpResponse( data, content_type='image/png') + response['Cache-Control'] = 'max-age=300' + return response if str(default) == 'identicon': p = Pydenticon5() @@ -193,9 +201,11 @@ class AvatarImageView(TemplateView): data = BytesIO() img.save(data, 'PNG', quality=JPEG_QUALITY) data.seek(0) - return HttpResponse( + response = HttpResponse( data, content_type='image/png') + response['Cache-Control'] = 'max-age=300' + return response if str(default) == 'mm' or str(default) == 'mp': # If mm is explicitly given, we need to catch that @@ -231,9 +241,11 @@ class AvatarImageView(TemplateView): obj.save() if imgformat == 'jpg': imgformat = 'jpeg' - return HttpResponse( + response = HttpResponse( data, content_type='image/%s' % imgformat) + response['Cache-Control'] = 'max-age=300' + return response class GravatarProxyView(View): ''' @@ -302,9 +314,11 @@ class GravatarProxyView(View): data = BytesIO(gravatarimagedata.read()) img = Image.open(data) data.seek(0) - return HttpResponse( + response = HttpResponse( data.read(), content_type='image/%s' % file_format(img.format)) + response['Cache-Control'] = 'max-age=300' + return response except ValueError as exc: print('Value error: %s' % exc) From fc284ade276f63f02e10148825d7883a160d811c Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 12:45:53 +0100 Subject: [PATCH 08/27] Handle export upload errors gracefully. Fixes issue #53 --- ivatar/ivataraccount/views.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ivatar/ivataraccount/views.py b/ivatar/ivataraccount/views.py index 40c3d0b..e63594f 100644 --- a/ivatar/ivataraccount/views.py +++ b/ivatar/ivataraccount/views.py @@ -816,12 +816,16 @@ class UploadLibravatarExportView(SuccessMessageMixin, FormView): def form_valid(self, form): data = self.request.FILES['export_file'] - items = libravatar_read_gzdata(data.read()) - # DEBUG print(items) - return render(self.request, 'choose_libravatar_export.html', { - 'emails': items['emails'], - 'photos': items['photos'], - }) + try: + items = libravatar_read_gzdata(data.read()) + # DEBUG print(items) + return render(self.request, 'choose_libravatar_export.html', { + 'emails': items['emails'], + 'photos': items['photos'], + }) + except Exception as e: + messages.error(self.request, _('Unable to parse file: %s' % e)) + return HttpResponseRedirect(reverse_lazy('upload_export')) @method_decorator(login_required, name='dispatch') From 99603863452905a5abb596dc25359cccd914043c Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 13:22:31 +0100 Subject: [PATCH 09/27] Fix issue #55 - check domain should also work without slash --- ivatar/tools/urls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ivatar/tools/urls.py b/ivatar/tools/urls.py index 9605ed4..1a13b43 100644 --- a/ivatar/tools/urls.py +++ b/ivatar/tools/urls.py @@ -8,4 +8,5 @@ from . views import CheckView, CheckDomainView urlpatterns = [ # pylint: disable=invalid-name url('check/', CheckView.as_view(), name='tools_check'), url('check_domain/', CheckDomainView.as_view(), name='tools_check_domain'), + url('check_domain$', CheckDomainView.as_view(), name='tools_check_domain'), ] From 9b924fff570b2c8fce71189ec353f2309a2e5d46 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 13:41:01 +0100 Subject: [PATCH 10/27] Add protocol, so links work correctly --- ivatar/tools/templates/check_domain.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ivatar/tools/templates/check_domain.html b/ivatar/tools/templates/check_domain.html index 560779b..be0f8ee 100644 --- a/ivatar/tools/templates/check_domain.html +++ b/ivatar/tools/templates/check_domain.html @@ -34,7 +34,6 @@
- {% if result %}

The following servers will be used for your domain

@@ -44,8 +43,8 @@
{% if result.avatar_server_http %} - -

{{result.avatar_server_http}}

+
+

http://{{result.avatar_server_http}}

{% if result.avatar_server_http_ipv4 %}
{{ result.avatar_server_http_ipv4 }}
@@ -66,8 +65,8 @@
{% if result.avatar_server_https %} - -

{{result.avatar_server_https}}

+
+

https://{{result.avatar_server_https}}

{% if result.avatar_server_https_ipv4 %}
{{ result.avatar_server_https_ipv4 }}
From 166582bc9d1a60dee0d635db468d15dbee65819e Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 8 Mar 2019 13:49:09 +0100 Subject: [PATCH 11/27] Increase the max age, create separate option in config for it (CACHE_IMAGE_MAX_AGE). Issue #50 --- config.py | 2 ++ ivatar/views.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/config.py b/config.py index bdadc3c..53d9f91 100644 --- a/config.py +++ b/config.py @@ -187,3 +187,5 @@ CACHES = { ], } } + +CACHE_IMAGES_MAX_AGE = 24 * 60 * 60 diff --git a/ivatar/views.py b/ivatar/views.py index 6b7bc79..b8c2743 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -22,6 +22,7 @@ import pagan from robohash import Robohash from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE +from ivatar.settings import CACHE_IMAGES_MAX_AGE from . ivataraccount.models import ConfirmedEmail, ConfirmedOpenId from . ivataraccount.models import pil_format, file_format @@ -150,7 +151,7 @@ class AvatarImageView(TemplateView): response = HttpResponse( data, content_type='image/png') - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response if str(default) == 'robohash': @@ -162,10 +163,10 @@ class AvatarImageView(TemplateView): data = BytesIO() robohash.img.save(data, format='png') data.seek(0) - response = HttpResponse( + response = HttpResponse( data, content_type='image/png') - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response if str(default) == 'retro': @@ -178,7 +179,7 @@ class AvatarImageView(TemplateView): response = HttpResponse( data, content_type='image/png') - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response if str(default) == 'pagan': @@ -190,7 +191,7 @@ class AvatarImageView(TemplateView): response = HttpResponse( data, content_type='image/png') - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response if str(default) == 'identicon': @@ -204,7 +205,7 @@ class AvatarImageView(TemplateView): response = HttpResponse( data, content_type='image/png') - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response if str(default) == 'mm' or str(default) == 'mp': @@ -244,7 +245,7 @@ class AvatarImageView(TemplateView): response = HttpResponse( data, content_type='image/%s' % imgformat) - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response class GravatarProxyView(View): @@ -317,7 +318,7 @@ class GravatarProxyView(View): response = HttpResponse( data.read(), content_type='image/%s' % file_format(img.format)) - response['Cache-Control'] = 'max-age=300' + response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE return response except ValueError as exc: From eead05c2f692e28d8a2e55ef914f93e103226620 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Mon, 11 Mar 2019 10:26:59 +0100 Subject: [PATCH 12/27] Add link to Mastodon profile --- templates/contact.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/contact.html b/templates/contact.html index af10e2a..5fdbfb5 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -30,6 +30,10 @@ If you've got a proposal to discuss or prefer to write to us, you can join our < You can also put short notices to our attention on Identica or Twitter. +

Mastodon

+ +Our Mastodon profile is available on https://photog.social/@libravatar. +

Email

Finally, if you need to email us: dev@libravatar.org From 6814be78d7a9c88381d1df95c5d70319162ca073 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Mon, 11 Mar 2019 11:03:24 +0100 Subject: [PATCH 13/27] Change cache for issue #50 --- config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 53d9f91..71207dc 100644 --- a/config.py +++ b/config.py @@ -188,4 +188,6 @@ CACHES = { } } -CACHE_IMAGES_MAX_AGE = 24 * 60 * 60 +# This is 5 minutes caching for generated/resized images, +# so the sites don't hit ivatar so much +CACHE_IMAGES_MAX_AGE = 5 * 60 From 9031c111a60092e6f891b9e9f02223714ae9af0a Mon Sep 17 00:00:00 2001 From: clime Date: Mon, 11 Mar 2019 11:24:19 +0100 Subject: [PATCH 14/27] add minimal climes theme --- ivatar/static/css/climes.css | 1 + ivatar/static/css/climes.less | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 ivatar/static/css/climes.css create mode 100644 ivatar/static/css/climes.less diff --git a/ivatar/static/css/climes.css b/ivatar/static/css/climes.css new file mode 100644 index 0000000..cac85e5 --- /dev/null +++ b/ivatar/static/css/climes.css @@ -0,0 +1 @@ +body{font-family:'Source Sans Pro',Helvetica,Arial,sans-serif;color:#525252}.btn{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;text-transform:uppercase;background:#ff8800;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s}.btn.btn-default{color:#ffa033;border-color:#ffa033;background:none}.btn.btn-primary{border-color:#b35f00}.btn:hover,.btn:active,.btn:focus{background:none;border-color:#cc6d00;color:#cc6d00}.btn:hover:after,.btn:active:after,.btn:focus:after{top:50%}.btn:after{content:'';position:absolute;z-index:-1;width:150%;height:200%;top:-190%;left:50%;background:#ffb866;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-webkit-transition:all .5s ease-out;-moz-transition:all .5s ease-out;-ms-transition:all .5s ease-out;transition:all .5s ease-out}.btn.btn-block:after{height:250%;width:200%;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);transform:translateX(-50%) translateY(-50%) skew(0, 2deg)}.hero{background-color:#ff8800;color:#fff;padding:90px 0 40px}.hero h1{font-weight:600;font-size:6em;color:rgba(255,255,255,0.5)}.hero h2{font-weight:200;font-size:30px;margin-bottom:30px}.hero small{color:rgba(0,0,0,0.4)}.hero .btn{display:inline-block}.hero .btn.btn-default{color:#ffbc70;border-color:#ffbc70;background:none}.hero .btn.btn-primary{border-color:#fff}.hero .btn:hover,.hero .btn:active,.hero .btn:focus{border-color:#fff;color:#995200}.hero .btn:after{background:rgba(255,255,255,0.5)}.hero .container{position:relative;z-index:10}.social{background-color:#ff8800;padding:30px 0 140px}.social ul{list-style:none;padding:0;margin:0}.social ul li{float:left;margin-right:15px;width:100px}.clipper,.clipper-footer{background-color:#fff;height:110px;width:100%;position:relative;top:-40px;-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);pointer-events:none;z-index:1}.clipper-footer{top:0}section.content{position:relative;top:-100px;margin-bottom:-100px;z-index:10}section.content h1,section.content h2,section.content h3,section.content h4,section.content h5,section.content h6{color:#cc6d00}section.content h2{font-weight:200;font-size:40px}section.content section{margin-bottom:20px;margin-top:20px}section.content .container>hr{-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);margin-top:80px;margin-bottom:40px}footer{background-color:#dddddd;color:#888888;padding:100px 0 40px;margin-top:-40px}footer .pull-left{margin-right:20px}footer .logo{float:left;display:inline-block;margin-right:5px;margin-top:-8px}footer .logo .circle{stroke:#888888;stroke-width:7;fill:none}footer .logo .polygon{fill:#888888}@media (max-width:768px){.hero{padding:50px 0 30px}.hero h1{font-size:4em}.social{padding:30px 0 100px}.btn{margin-bottom:5px}section.content section{margin-bottom:50px}}.color{display:inline-block;border-radius:50%;height:20px;width:20px}.color.blue{background-color:#36b7d7}.color.green{background-color:#3aa850}.color.red{background-color:#f7645e}.color.black{background-color:#525252}.navbar-tortin{border:0;background-color:#ff8800;color:#FFFFFF;border-radius:0}.form-control{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s;border-color:#ffa033;background:none}.form-control:focus{border-color:#cc6d00;box-shadow:none}.navbar-tortin .navbar-brand,.navbar-tortin .navbar-text,.navbar-tortin .navbar-nav>li>a,.navbar-tortin .navbar-link,.navbar-tortin .btn-link{color:#FFFFFF}.navbar-tortin .navbar-nav>.active>a,.navbar-tortin .navbar-nav>.active>a:focus,.navbar-tortin .navbar-nav>.active>a:hover,.navbar-tortin .navbar-nav>li>a:focus,.navbar-tortin .navbar-nav>li>a:hover,.navbar-tortin .navbar-link:hover,.navbar-tortin .btn-link:focus,.navbar-tortin .btn-link:hover,.navbar-tortin .navbar-nav>.open>a,.navbar-tortin .navbar-nav>.open>a:focus,.navbar-tortin .navbar-nav>.open>a:hover{background-color:#cc6d00}.navbar-tortin .navbar-toggle{border-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover{background-color:#FFFFFF}.navbar-tortin .navbar-toggle .icon-bar{background-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover .icon-bar{background-color:#ff8800}.navbar-tortin .navbar-collapse,.navbar-tortin .navbar-form{border:0}.dropdown-menu{background-color:#ff8800;border:1px solid #cc6d00}.dropdown-menu>li>a{color:#FFFFFF}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#cc6d00;color:#FFFFFF}.checkbox input,.radio input{display:none}.checkbox input+label,.radio input+label{padding-left:0}.checkbox input+label:before,.radio input+label:before{font-family:FontAwesome;display:inline-block;letter-spacing:5px;font-size:20px;color:#ff8800;vertical-align:middle}.checkbox input+label:before{content:"\f0c8"}.checkbox input:checked+label:before{content:"\f14a"}.radio input+label:before{content:"\f10c"}.radio input:checked+label:before{content:"\f192"}.uploadbtn:before{position:absolute;left:0;right:0;text-align:center;content:"Select file";font-family:'Montserrat',sans-serif}.jcrop-holder>div>div:nth-child(1){outline-width:2px;outline-style:solid;outline-color:#ff8800}@media (max-width:767px){.navbar-tortin .navbar-nav .open .dropdown-menu>li>a{color:#FFFFFF}.navbar-tortin .navbar-nav .open .dropdown-menu>li>a:hover{background-color:#cc6d00}.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:hover{background-color:#cc6d00}}.panel-tortin{border-color:#ff8800;border-bottom-width:3px}.panel-tortin>.panel-heading{color:#fff;background-color:#ff8800;border-color:#ff8800;font-family:'Montserrat',sans-serif}.panel-tortin>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ff8800}.panel-tortin>.panel-heading .badge{color:#ff8800;background-color:#fff}.panel-tortin>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ff8800}.alert.alert-danger{background-color:#FFFFFF;color:#f7645e;border-color:#f7645e;border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative}.input-group-addon{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;border-color:#ffa033;background:none;width:auto;height:36px}.radio{color:#ff8800}input[type="radio"]:checked+label{font-weight:bold}.btn{border-radius:0 !important} diff --git a/ivatar/static/css/climes.less b/ivatar/static/css/climes.less new file mode 100644 index 0000000..e6c7b4d --- /dev/null +++ b/ivatar/static/css/climes.less @@ -0,0 +1,6 @@ +@import 'tortin.less'; +@bg-hero:#ff8800; + +.btn { + border-radius: 0px !important; +} From aede1750d30b1b406d779abe184d934aa16b23db Mon Sep 17 00:00:00 2001 From: clime Date: Mon, 11 Mar 2019 13:13:36 +0100 Subject: [PATCH 15/27] rename climes.less and climes.css to clime.less and clime.css --- ivatar/static/css/{climes.css => clime.css} | 0 ivatar/static/css/{climes.less => clime.less} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename ivatar/static/css/{climes.css => clime.css} (100%) rename ivatar/static/css/{climes.less => clime.less} (100%) diff --git a/ivatar/static/css/climes.css b/ivatar/static/css/clime.css similarity index 100% rename from ivatar/static/css/climes.css rename to ivatar/static/css/clime.css diff --git a/ivatar/static/css/climes.less b/ivatar/static/css/clime.less similarity index 100% rename from ivatar/static/css/climes.less rename to ivatar/static/css/clime.less From d4614b7d99147600a60f86af2788a793d6e444d3 Mon Sep 17 00:00:00 2001 From: clime Date: Mon, 11 Mar 2019 13:15:39 +0100 Subject: [PATCH 16/27] improve colors in clime's theme --- ivatar/static/css/clime.css | 2 +- ivatar/static/css/clime.less | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ivatar/static/css/clime.css b/ivatar/static/css/clime.css index cac85e5..b067de9 100644 --- a/ivatar/static/css/clime.css +++ b/ivatar/static/css/clime.css @@ -1 +1 @@ -body{font-family:'Source Sans Pro',Helvetica,Arial,sans-serif;color:#525252}.btn{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;text-transform:uppercase;background:#ff8800;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s}.btn.btn-default{color:#ffa033;border-color:#ffa033;background:none}.btn.btn-primary{border-color:#b35f00}.btn:hover,.btn:active,.btn:focus{background:none;border-color:#cc6d00;color:#cc6d00}.btn:hover:after,.btn:active:after,.btn:focus:after{top:50%}.btn:after{content:'';position:absolute;z-index:-1;width:150%;height:200%;top:-190%;left:50%;background:#ffb866;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-webkit-transition:all .5s ease-out;-moz-transition:all .5s ease-out;-ms-transition:all .5s ease-out;transition:all .5s ease-out}.btn.btn-block:after{height:250%;width:200%;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);transform:translateX(-50%) translateY(-50%) skew(0, 2deg)}.hero{background-color:#ff8800;color:#fff;padding:90px 0 40px}.hero h1{font-weight:600;font-size:6em;color:rgba(255,255,255,0.5)}.hero h2{font-weight:200;font-size:30px;margin-bottom:30px}.hero small{color:rgba(0,0,0,0.4)}.hero .btn{display:inline-block}.hero .btn.btn-default{color:#ffbc70;border-color:#ffbc70;background:none}.hero .btn.btn-primary{border-color:#fff}.hero .btn:hover,.hero .btn:active,.hero .btn:focus{border-color:#fff;color:#995200}.hero .btn:after{background:rgba(255,255,255,0.5)}.hero .container{position:relative;z-index:10}.social{background-color:#ff8800;padding:30px 0 140px}.social ul{list-style:none;padding:0;margin:0}.social ul li{float:left;margin-right:15px;width:100px}.clipper,.clipper-footer{background-color:#fff;height:110px;width:100%;position:relative;top:-40px;-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);pointer-events:none;z-index:1}.clipper-footer{top:0}section.content{position:relative;top:-100px;margin-bottom:-100px;z-index:10}section.content h1,section.content h2,section.content h3,section.content h4,section.content h5,section.content h6{color:#cc6d00}section.content h2{font-weight:200;font-size:40px}section.content section{margin-bottom:20px;margin-top:20px}section.content .container>hr{-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);margin-top:80px;margin-bottom:40px}footer{background-color:#dddddd;color:#888888;padding:100px 0 40px;margin-top:-40px}footer .pull-left{margin-right:20px}footer .logo{float:left;display:inline-block;margin-right:5px;margin-top:-8px}footer .logo .circle{stroke:#888888;stroke-width:7;fill:none}footer .logo .polygon{fill:#888888}@media (max-width:768px){.hero{padding:50px 0 30px}.hero h1{font-size:4em}.social{padding:30px 0 100px}.btn{margin-bottom:5px}section.content section{margin-bottom:50px}}.color{display:inline-block;border-radius:50%;height:20px;width:20px}.color.blue{background-color:#36b7d7}.color.green{background-color:#3aa850}.color.red{background-color:#f7645e}.color.black{background-color:#525252}.navbar-tortin{border:0;background-color:#ff8800;color:#FFFFFF;border-radius:0}.form-control{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s;border-color:#ffa033;background:none}.form-control:focus{border-color:#cc6d00;box-shadow:none}.navbar-tortin .navbar-brand,.navbar-tortin .navbar-text,.navbar-tortin .navbar-nav>li>a,.navbar-tortin .navbar-link,.navbar-tortin .btn-link{color:#FFFFFF}.navbar-tortin .navbar-nav>.active>a,.navbar-tortin .navbar-nav>.active>a:focus,.navbar-tortin .navbar-nav>.active>a:hover,.navbar-tortin .navbar-nav>li>a:focus,.navbar-tortin .navbar-nav>li>a:hover,.navbar-tortin .navbar-link:hover,.navbar-tortin .btn-link:focus,.navbar-tortin .btn-link:hover,.navbar-tortin .navbar-nav>.open>a,.navbar-tortin .navbar-nav>.open>a:focus,.navbar-tortin .navbar-nav>.open>a:hover{background-color:#cc6d00}.navbar-tortin .navbar-toggle{border-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover{background-color:#FFFFFF}.navbar-tortin .navbar-toggle .icon-bar{background-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover .icon-bar{background-color:#ff8800}.navbar-tortin .navbar-collapse,.navbar-tortin .navbar-form{border:0}.dropdown-menu{background-color:#ff8800;border:1px solid #cc6d00}.dropdown-menu>li>a{color:#FFFFFF}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#cc6d00;color:#FFFFFF}.checkbox input,.radio input{display:none}.checkbox input+label,.radio input+label{padding-left:0}.checkbox input+label:before,.radio input+label:before{font-family:FontAwesome;display:inline-block;letter-spacing:5px;font-size:20px;color:#ff8800;vertical-align:middle}.checkbox input+label:before{content:"\f0c8"}.checkbox input:checked+label:before{content:"\f14a"}.radio input+label:before{content:"\f10c"}.radio input:checked+label:before{content:"\f192"}.uploadbtn:before{position:absolute;left:0;right:0;text-align:center;content:"Select file";font-family:'Montserrat',sans-serif}.jcrop-holder>div>div:nth-child(1){outline-width:2px;outline-style:solid;outline-color:#ff8800}@media (max-width:767px){.navbar-tortin .navbar-nav .open .dropdown-menu>li>a{color:#FFFFFF}.navbar-tortin .navbar-nav .open .dropdown-menu>li>a:hover{background-color:#cc6d00}.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:hover{background-color:#cc6d00}}.panel-tortin{border-color:#ff8800;border-bottom-width:3px}.panel-tortin>.panel-heading{color:#fff;background-color:#ff8800;border-color:#ff8800;font-family:'Montserrat',sans-serif}.panel-tortin>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ff8800}.panel-tortin>.panel-heading .badge{color:#ff8800;background-color:#fff}.panel-tortin>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ff8800}.alert.alert-danger{background-color:#FFFFFF;color:#f7645e;border-color:#f7645e;border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative}.input-group-addon{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;border-color:#ffa033;background:none;width:auto;height:36px}.radio{color:#ff8800}input[type="radio"]:checked+label{font-weight:bold}.btn{border-radius:0 !important} +body{font-family:'Source Sans Pro',Helvetica,Arial,sans-serif;color:#525252}.btn{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;text-transform:uppercase;background:#ff4400;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s}.btn.btn-default{color:#ff6933;border-color:#ff6933;background:none}.btn.btn-primary{border-color:#b33000}.btn:hover,.btn:active,.btn:focus{background:none;border-color:#cc3600;color:#cc3600}.btn:hover:after,.btn:active:after,.btn:focus:after{top:50%}.btn:after{content:'';position:absolute;z-index:-1;width:150%;height:200%;top:-190%;left:50%;background:#ff8f66;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 5deg);transform:translateX(-50%) translateY(-50%) skew(0, 5deg);-webkit-transition:all .5s ease-out;-moz-transition:all .5s ease-out;-ms-transition:all .5s ease-out;transition:all .5s ease-out}.btn.btn-block:after{height:250%;width:200%;-webkit-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-moz-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);-ms-transform:translateX(-50%) translateY(-50%) skew(0, 2deg);transform:translateX(-50%) translateY(-50%) skew(0, 2deg)}.hero{background-color:#ff4400;color:#fff;padding:90px 0 40px}.hero h1{font-weight:600;font-size:6em;color:rgba(255,255,255,0.5)}.hero h2{font-weight:200;font-size:30px;margin-bottom:30px}.hero small{color:rgba(0,0,0,0.4)}.hero .btn{display:inline-block}.hero .btn.btn-default{color:#ff9670;border-color:#ff9670;background:none}.hero .btn.btn-primary{border-color:#fff}.hero .btn:hover,.hero .btn:active,.hero .btn:focus{border-color:#fff;color:#992900}.hero .btn:after{background:rgba(255,255,255,0.5)}.hero .container{position:relative;z-index:10}.social{background-color:#ff4400;padding:30px 0 140px}.social ul{list-style:none;padding:0;margin:0}.social ul li{float:left;margin-right:15px;width:100px}.clipper,.clipper-footer{background-color:#fff;height:110px;width:100%;position:relative;top:-40px;-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);pointer-events:none;z-index:1}.clipper-footer{top:0}section.content{position:relative;top:-100px;margin-bottom:-100px;z-index:10}section.content h1,section.content h2,section.content h3,section.content h4,section.content h5,section.content h6{color:#cc3600}section.content h2{font-weight:200;font-size:40px}section.content section{margin-bottom:20px;margin-top:20px}section.content .container>hr{-webkit-transform:skew(0, 2deg);-moz-transform:skew(0, 2deg);-ms-transform:skew(0, 2deg);transform:skew(0, 2deg);margin-top:80px;margin-bottom:40px}footer{background-color:#dddddd;color:#888888;padding:100px 0 40px;margin-top:-40px}footer .pull-left{margin-right:20px}footer .logo{float:left;display:inline-block;margin-right:5px;margin-top:-8px}footer .logo .circle{stroke:#888888;stroke-width:7;fill:none}footer .logo .polygon{fill:#888888}@media (max-width:768px){.hero{padding:50px 0 30px}.hero h1{font-size:4em}.social{padding:30px 0 100px}.btn{margin-bottom:5px}section.content section{margin-bottom:50px}}.color{display:inline-block;border-radius:50%;height:20px;width:20px}.color.blue{background-color:#36b7d7}.color.green{background-color:#3aa850}.color.red{background-color:#f7645e}.color.black{background-color:#525252}.navbar-tortin{border:0;background-color:#ff4400;color:#FFFFFF;border-radius:0}.form-control{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;-webkit-transition:all .3s;-moz-transition:all .3s;-ms-transition:all .3s;transition:all .3s;border-color:#ff6933;background:none}.form-control:focus{border-color:#cc3600;box-shadow:none}.navbar-tortin .navbar-brand,.navbar-tortin .navbar-text,.navbar-tortin .navbar-nav>li>a,.navbar-tortin .navbar-link,.navbar-tortin .btn-link{color:#FFFFFF}.navbar-tortin .navbar-nav>.active>a,.navbar-tortin .navbar-nav>.active>a:focus,.navbar-tortin .navbar-nav>.active>a:hover,.navbar-tortin .navbar-nav>li>a:focus,.navbar-tortin .navbar-nav>li>a:hover,.navbar-tortin .navbar-link:hover,.navbar-tortin .btn-link:focus,.navbar-tortin .btn-link:hover,.navbar-tortin .navbar-nav>.open>a,.navbar-tortin .navbar-nav>.open>a:focus,.navbar-tortin .navbar-nav>.open>a:hover{background-color:#cc3600}.navbar-tortin .navbar-toggle{border-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover{background-color:#FFFFFF}.navbar-tortin .navbar-toggle .icon-bar{background-color:#FFFFFF}.navbar-tortin .navbar-toggle:hover .icon-bar{background-color:#ff4400}.navbar-tortin .navbar-collapse,.navbar-tortin .navbar-form{border:0}.dropdown-menu{background-color:#ff4400;border:1px solid #cc3600}.dropdown-menu>li>a{color:#FFFFFF}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#cc3600;color:#FFFFFF}.checkbox input,.radio input{display:none}.checkbox input+label,.radio input+label{padding-left:0}.checkbox input+label:before,.radio input+label:before{font-family:FontAwesome;display:inline-block;letter-spacing:5px;font-size:20px;color:#ff4400;vertical-align:middle}.checkbox input+label:before{content:"\f0c8"}.checkbox input:checked+label:before{content:"\f14a"}.radio input+label:before{content:"\f10c"}.radio input:checked+label:before{content:"\f192"}.uploadbtn:before{position:absolute;left:0;right:0;text-align:center;content:"Select file";font-family:'Montserrat',sans-serif}.jcrop-holder>div>div:nth-child(1){outline-width:2px;outline-style:solid;outline-color:#ff4400}@media (max-width:767px){.navbar-tortin .navbar-nav .open .dropdown-menu>li>a{color:#FFFFFF}.navbar-tortin .navbar-nav .open .dropdown-menu>li>a:hover{background-color:#cc3600}.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-tortin .navbar-nav .open .dropdown-menu>.active>a:hover{background-color:#cc3600}}.panel-tortin{border-color:#ff4400;border-bottom-width:3px}.panel-tortin>.panel-heading{color:#fff;background-color:#ff4400;border-color:#ff4400;font-family:'Montserrat',sans-serif}.panel-tortin>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ff4400}.panel-tortin>.panel-heading .badge{color:#ff4400;background-color:#fff}.panel-tortin>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ff4400}.alert.alert-danger{background-color:#FFFFFF;color:#f7645e;border-color:#f7645e;border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative}.input-group-addon{border-bottom-width:3px;box-sizing:border-box;font-family:'Montserrat',sans-serif;overflow:hidden;position:relative;border-color:#ff6933;background:none;width:auto;height:36px}.radio{color:#ff4400}input[type="radio"]:checked+label{font-weight:bold}.btn{border-radius:0 !important}section.content h1,section.content h2,section.content h3,section.content h4,section.content h5,section.content h6{color:#ff4400} \ No newline at end of file diff --git a/ivatar/static/css/clime.less b/ivatar/static/css/clime.less index e6c7b4d..9124cf4 100644 --- a/ivatar/static/css/clime.less +++ b/ivatar/static/css/clime.less @@ -1,6 +1,10 @@ @import 'tortin.less'; -@bg-hero:#ff8800; +@bg-hero:#ff4400; .btn { border-radius: 0px !important; } + +section.content h1, section.content h2, section.content h3, section.content h4, section.content h5, section.content h6 { + color: #ff4400; +} From dbee3271b0862f3811ea8e0b3b9f997686bd1945 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Wed, 13 Mar 2019 13:55:23 +0100 Subject: [PATCH 17/27] Add example proxy script --- libravatarproxy.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 libravatarproxy.py diff --git a/libravatarproxy.py b/libravatarproxy.py new file mode 100755 index 0000000..eb19fc8 --- /dev/null +++ b/libravatarproxy.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import urllib.request +import sys +import os + +sys.stderr.buffer.write(b'%s' % bytes(os.environ.get("QUERY_STRING", "No Query String in url"), 'utf-8')) + +link = 'https://www.libravatar.org/avatar/%s' % os.environ.get("QUERY_STRING", 'x'*32) +sys.stderr.buffer.write(b'%s' % bytes(link, 'utf-8')) + +data = None +with urllib.request.urlopen(link) as f: + data = f.read() + +for header in f.headers._headers: + if header[0] == 'Content-Type': + sys.stdout.buffer.write(b"%s: %s\n\n" % (bytes(header[0], 'utf-8'), bytes(header[1], 'utf-8'))) + sys.stdout.flush() + break + +sys.stdout.buffer.write(data) From 93961a6a700c9080d2074a5650bffdd34fd7026d Mon Sep 17 00:00:00 2001 From: Niklas Poslovski Date: Wed, 13 Mar 2019 17:38:46 +0100 Subject: [PATCH 18/27] Fix scaling on mobile devices --- templates/header.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/header.html b/templates/header.html index 5015f04..f197514 100644 --- a/templates/header.html +++ b/templates/header.html @@ -31,6 +31,7 @@ {% endif %} {% endif %} + From 1daff19efa686cd510665b8f0be56e3cbc310df2 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Thu, 14 Mar 2019 10:07:14 +0100 Subject: [PATCH 19/27] Enhance wording and spacing --- templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/home.html b/templates/home.html index 484c32e..84ad794 100644 --- a/templates/home.html +++ b/templates/home.html @@ -37,7 +37,7 @@
{% endif %} -{% trans 'Check email' %}  + {% trans 'Check' %} 
From 788116a06f23ae513c9aba1bd7e64d634edd4567 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 15 Mar 2019 15:52:20 +0100 Subject: [PATCH 20/27] Redirect to deadbeef in case digest length is incorrect - addresses issue #43 --- ivatar/urls.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ivatar/urls.py b/ivatar/urls.py index a7a4870..7ba926b 100644 --- a/ivatar/urls.py +++ b/ivatar/urls.py @@ -24,11 +24,7 @@ urlpatterns = [ # pylint: disable=invalid-name url(r'avatar/$', AvatarImageView.as_view(), name='avatar_view'), url( r'avatar/(?P\w*)', - TemplateView.as_view( - template_name='error.html', - extra_context={ - 'errormessage': 'Incorrect digest length', - })), + RedirectView.as_view(url='/static/img/deadbeef.png'), name='invalid_hash'), url( r'gravatarproxy/(?P\w*)', GravatarProxyView.as_view(), name='gravatarproxy'), From 8e7badf1258103ce43d079cdbe7eeb97173d85a5 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 15 Mar 2019 16:03:08 +0100 Subject: [PATCH 21/27] Adapt test, to fix test regression from commit 788116a0 --- ivatar/test_views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ivatar/test_views.py b/ivatar/test_views.py index dbed347..cc18515 100644 --- a/ivatar/test_views.py +++ b/ivatar/test_views.py @@ -61,5 +61,8 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods """ Test incorrect digest """ - response = self.client.get('/avatar/%s' % 'x'*65) - self.assertEqual(response.status_code, 200, 'no 200 ok?') + response = self.client.get('/avatar/%s' % 'x'*65, follow=True) + self.assertRedirects( + response=response, + expected_url='/static/img/deadbeef.png', + msg_prefix='Why does an invalid hash not redirect to deadbeef?') From 911d0b56a5d1812d69487a3bb632678eefac454d Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Thu, 21 Mar 2019 16:39:57 +0100 Subject: [PATCH 22/27] Redir to deadbeef if hash is wrong --- ivatar/test_views.py | 7 +++++-- ivatar/urls.py | 6 +----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ivatar/test_views.py b/ivatar/test_views.py index dbed347..cc18515 100644 --- a/ivatar/test_views.py +++ b/ivatar/test_views.py @@ -61,5 +61,8 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods """ Test incorrect digest """ - response = self.client.get('/avatar/%s' % 'x'*65) - self.assertEqual(response.status_code, 200, 'no 200 ok?') + response = self.client.get('/avatar/%s' % 'x'*65, follow=True) + self.assertRedirects( + response=response, + expected_url='/static/img/deadbeef.png', + msg_prefix='Why does an invalid hash not redirect to deadbeef?') diff --git a/ivatar/urls.py b/ivatar/urls.py index a7a4870..7ba926b 100644 --- a/ivatar/urls.py +++ b/ivatar/urls.py @@ -24,11 +24,7 @@ urlpatterns = [ # pylint: disable=invalid-name url(r'avatar/$', AvatarImageView.as_view(), name='avatar_view'), url( r'avatar/(?P\w*)', - TemplateView.as_view( - template_name='error.html', - extra_context={ - 'errormessage': 'Incorrect digest length', - })), + RedirectView.as_view(url='/static/img/deadbeef.png'), name='invalid_hash'), url( r'gravatarproxy/(?P\w*)', GravatarProxyView.as_view(), name='gravatarproxy'), From c12534224e9bbccec945fccdf0eb199bd0b21f5f Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 19 Apr 2019 13:16:39 +0200 Subject: [PATCH 23/27] Add required text, so it's clear this checkbox needs to be checked --- ivatar/ivataraccount/templates/upload_photo.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivatar/ivataraccount/templates/upload_photo.html b/ivatar/ivataraccount/templates/upload_photo.html index 4eb3e7b..19177b5 100644 --- a/ivatar/ivataraccount/templates/upload_photo.html +++ b/ivatar/ivataraccount/templates/upload_photo.html @@ -28,13 +28,13 @@
- +
- +
From 9e48389e0817a0f6d144d8ad22853d7cd6f95f81 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 19 Apr 2019 13:17:04 +0200 Subject: [PATCH 24/27] If password is set to excl. mark, we need to set a random pass as well --- ivatar/ivataraccount/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivatar/ivataraccount/views.py b/ivatar/ivataraccount/views.py index e63594f..62ac7c9 100644 --- a/ivatar/ivataraccount/views.py +++ b/ivatar/ivataraccount/views.py @@ -918,7 +918,7 @@ class PasswordResetView(PasswordResetViewOriginal): try: confirmed_email = ConfirmedEmail.objects.get(email=request.POST['email']) confirmed_email.user.email = confirmed_email.email - if not confirmed_email.user.password: + if not confirmed_email.user.password or confirmed_email.user.password == '!': random_pass = User.objects.make_random_password() confirmed_email.user.set_pasword(random_pass) confirmed_email.user.save() From da731425bc9f7d24ba8c5cc5388239e3fe02be99 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 19 Apr 2019 13:28:38 +0200 Subject: [PATCH 25/27] Avoid building psycopg from source --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d2bdc99..760b3df 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ wheel yapf django-anymail[mailgun] mysqlclient -psycopg2 +psycopg2-binary notsetuptools git+https://github.com/ofalk/monsterid.git git+https://github.com/ofalk/Robohash.git@devel From 22f24624fc397716b60e11f920d3417c1172cba5 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 19 Apr 2019 14:28:00 +0200 Subject: [PATCH 26/27] Switch to Fedora for building, since prod/stg are also on Fedora and we need newer SQLite to do testing --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8f61d0..8e6b5af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ -image: ofalk/centos7-python36 +image: docker.io/ofalk/fedora28-python3 before_script: - - virtualenv -p python3.6 /tmp/.virtualenv + - virtualenv -p python3 /tmp/.virtualenv - source /tmp/.virtualenv/bin/activate - pip install Pillow - pip install -r requirements.txt From f86c9baef6de0f995c9ae90e89f559769f10dbd9 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 19 Apr 2019 15:09:51 +0200 Subject: [PATCH 27/27] Must use virtualenv-3 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e6b5af..edb456d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ image: docker.io/ofalk/fedora28-python3 before_script: - - virtualenv -p python3 /tmp/.virtualenv + - virtualenv-3 -p python3 /tmp/.virtualenv - source /tmp/.virtualenv/bin/activate - pip install Pillow - pip install -r requirements.txt