diff --git a/README.md b/README.md index 558d42d45..f8b2eb1f6 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Keep track of what books you've read, and what books you'd like to read in the f Federation allows you to interact with users on other instances and services, and also shares metadata about books and authors, which collaboratively builds a decentralized database of books. ### Privacy and moderation -Users and administrators can control who can see thier posts and what other instances to federate with. +Users and administrators can control who can see their posts and what other instances to federate with. ## Tech Stack Web backend diff --git a/bookwyrm/emailing.py b/bookwyrm/emailing.py index 80aacf7f4..03cf4772e 100644 --- a/bookwyrm/emailing.py +++ b/bookwyrm/emailing.py @@ -38,7 +38,7 @@ def password_reset_email(reset_code): data = email_data() data["reset_link"] = reset_code.link data["user"] = reset_code.user.display_name - send_email.delay(reset_code.user.email, *format_email("password_reset", data)) + send_email(reset_code.user.email, *format_email("password_reset", data)) def moderation_report_email(report): diff --git a/bookwyrm/static/css/themes/bookwyrm-dark.scss b/bookwyrm/static/css/themes/bookwyrm-dark.scss index a2eb94efb..b98422688 100644 --- a/bookwyrm/static/css/themes/bookwyrm-dark.scss +++ b/bookwyrm/static/css/themes/bookwyrm-dark.scss @@ -92,6 +92,10 @@ $family-secondary: $family-sans-serif; color: $grey-light !important; } +#qrcode svg { + background-color: #a6a6a6; +} + @import "../bookwyrm.scss"; @import "../vendor/icons.css"; @import "../vendor/shepherd.scss"; diff --git a/bookwyrm/templates/preferences/2fa.html b/bookwyrm/templates/preferences/2fa.html index b0703bc4a..27ef026fb 100644 --- a/bookwyrm/templates/preferences/2fa.html +++ b/bookwyrm/templates/preferences/2fa.html @@ -45,7 +45,30 @@

{% trans "Scan the QR code with your authentication app and then enter the code from your app below to confirm your app is set up." %}

-
{{ qrcode | safe }}
+
{{ qrcode | safe }}
+
+ + + {% trans "Use setup key" %} + + + +
+
+ {% trans "Account name:" %} +
+
+ {{ user.username }} +
+ +
+ {% trans "Code:" %} +
+
+ {{ code | safe }} +
+
+
{{ form.otp }} diff --git a/bookwyrm/templates/robots.txt b/bookwyrm/templates/robots.txt index a328b6e90..4aa091277 100644 --- a/bookwyrm/templates/robots.txt +++ b/bookwyrm/templates/robots.txt @@ -73,6 +73,14 @@ User-agent: PetalBot Disallow: / +User-agent: DataForSeoBot +Disallow: / + +User-agent: YisouSpider +Disallow: / + + User-agent: * +Crawl-delay: 10 Disallow: /static/js/ Disallow: /static/css/ diff --git a/bookwyrm/templates/snippets/footer.html b/bookwyrm/templates/snippets/footer.html index eacb6d6b7..77be88bfe 100644 --- a/bookwyrm/templates/snippets/footer.html +++ b/bookwyrm/templates/snippets/footer.html @@ -24,7 +24,7 @@

- {% trans "Code of Conduct" %} + {% trans "Code of Conduct" %}

{% trans "Privacy Policy" %} diff --git a/bookwyrm/tests/test_emailing.py b/bookwyrm/tests/test_emailing.py index ecfbd9448..b2af59f4f 100644 --- a/bookwyrm/tests/test_emailing.py +++ b/bookwyrm/tests/test_emailing.py @@ -11,6 +11,7 @@ from bookwyrm import emailing, models class Emailing(TestCase): """every response to a get request, html or json""" + # pylint: disable=invalid-name def setUp(self): """we need basic test data and mocks""" self.factory = RequestFactory() @@ -41,10 +42,12 @@ class Emailing(TestCase): self.assertEqual(args[1], "You're invited to join BookWyrm!") self.assertEqual(len(args), 4) - def test_password_reset_email(self, email_mock): + def test_password_reset_email(self, _): """load the password reset email""" reset = models.PasswordReset.objects.create(user=self.local_user) - emailing.password_reset_email(reset) + + with patch("bookwyrm.emailing.send_email") as email_mock: + emailing.password_reset_email(reset) self.assertEqual(email_mock.call_count, 1) args = email_mock.call_args[0] diff --git a/bookwyrm/views/list/list.py b/bookwyrm/views/list/list.py index 3797997a9..1adf7a679 100644 --- a/bookwyrm/views/list/list.py +++ b/bookwyrm/views/list/list.py @@ -110,8 +110,8 @@ def get_list_suggestions(book_list, user, query=None): s.default_edition for s in models.Work.objects.filter( ~Q(editions__in=book_list.books.all()), - ).order_by("-updated_date") - ][: 5 - len(suggestions)] + ).order_by("-updated_date")[: 5 - len(suggestions)] + ] return suggestions diff --git a/bookwyrm/views/preferences/two_factor_auth.py b/bookwyrm/views/preferences/two_factor_auth.py index f3b04eb3c..192cdaff7 100644 --- a/bookwyrm/views/preferences/two_factor_auth.py +++ b/bookwyrm/views/preferences/two_factor_auth.py @@ -35,10 +35,12 @@ class Edit2FA(View): if not form.is_valid(): data = {"form": form} return TemplateResponse(request, "preferences/2fa.html", data) + data = self.create_qr_code(request.user) qr_form = forms.Confirm2FAForm() data = { "password_confirmed": True, - "qrcode": self.create_qr_code(request.user), + "qrcode": data[0], + "code": data[1], "form": qr_form, } return TemplateResponse(request, "preferences/2fa.html", data) @@ -57,7 +59,10 @@ class Edit2FA(View): qr_code.add_data(provisioning_url) qr_code.make(fit=True) img = qr_code.make_image(attrib={"fill": "black"}) - return str(img.to_string(), "utf-8") # to_string() returns a byte string + return [ + str(img.to_string(), "utf-8"), + otp_secret, + ] # to_string() returns a byte string @method_decorator(login_required, name="dispatch") diff --git a/docker-compose.yml b/docker-compose.yml index 531467399..09a07ba99 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,8 @@ services: image: nginx:latest restart: unless-stopped ports: - - 80:80 - - 443:443 + - "80:80" + - "443:443" depends_on: - web networks: @@ -50,7 +50,7 @@ services: networks: - main ports: - - 8000 + - "8000" redis_activity: image: redis command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT}