From 190ce18f9e7a4852d45c314cec9b226fc0c245a7 Mon Sep 17 00:00:00 2001
From: Sam Wilson
Date: Thu, 27 Oct 2022 07:06:03 +0200
Subject: [PATCH] Update docs, and fix bugs in user form and Flickr import
---
docs/contacts.rst | 35 ++++++++++++++++++++++++++++++
docs/index.rst | 1 +
docs/posts.rst | 2 +-
src/Command/TwyneFlickrCommand.php | 2 +-
templates/contact/form.html.twig | 2 +-
5 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 docs/contacts.rst
diff --git a/docs/contacts.rst b/docs/contacts.rst
new file mode 100644
index 0000000..d37d216
--- /dev/null
+++ b/docs/contacts.rst
@@ -0,0 +1,35 @@
+.. _contacts:
+
+Contacts and Users
+==================
+
+Contacts in Twyne represent :ref:`post ` Authors, and can also be made into site Users.
+When a new Twyne site is installed an initial Contact and matching User are created,
+with full admin rights for everything.
+
+All Contacts have a name, homepage URL, and two descriptions (one public, one private).
+Contacts that are also site users have, in addition, a username and email address,
+and a set of user groups that they belong to.
+
+Creating a Contact
+------------------
+
+There are various ways to create a new Contact:
+
+* Go to 'Contacts' in the main menu, and then the 'New contact' link.
+* When editing a post, or in the upload form, the author field is free-text.
+ If an unknown author name is used, a new Contact will be created.
+* Registering a new user account will result in a matching Contact being created.
+
+User Authentication
+-------------------
+
+All users are identified by their username, and authenticate with a password.
+Two-factor authentication is also enabled by default,
+requiring the use of an TOTP app.
+
+If a user loses their 2FA credentials, their account can be reset by using the reset command, e.g.::
+
+ ./bin/console twyne:reset-2fa --username alice
+
+This will force then to re-register a 2FA device.
diff --git a/docs/index.rst b/docs/index.rst
index 1cf7c5c..238d7ba 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -28,6 +28,7 @@ we will endevour to fix up the manual to make it clearer about that topic.
install
config
settings
+ contacts
posts
tags
syndications
diff --git a/docs/posts.rst b/docs/posts.rst
index 5ae2d60..3779352 100644
--- a/docs/posts.rst
+++ b/docs/posts.rst
@@ -40,7 +40,7 @@ Author
A Post must have an author (even if that author is the ever-prolific "anon.").
A site's default author can be set with the ``APP_MAIN_CONTACT`` environment variable,
-which is a reference to the ID of whichever Contact should be the default
+which is a reference to the ID of whichever :ref:`Contact ` should be the default
(usually this is the first user, which is created at install-time).
Title
diff --git a/src/Command/TwyneFlickrCommand.php b/src/Command/TwyneFlickrCommand.php
index d139603..eabb249 100644
--- a/src/Command/TwyneFlickrCommand.php
+++ b/src/Command/TwyneFlickrCommand.php
@@ -328,7 +328,7 @@ public function importOnePhoto(array $photo)
'latitude' => $photo['latitude'],
'longitude' => $photo['longitude'],
'view_group' => $viewGroup,
- 'tags' => join('; ', $tags),
+ 'tags' => $tags,
'new_syndication' => ['url' => $photoUrl, 'label' => 'Flickr'],
];
$this->postRepository->saveFromRequest($post, new Request([], $requestParams), $uploadedFile);
diff --git a/templates/contact/form.html.twig b/templates/contact/form.html.twig
index a9de6e6..f216795 100644
--- a/templates/contact/form.html.twig
+++ b/templates/contact/form.html.twig
@@ -53,7 +53,7 @@
Is 2FA configured?
- {% if contact.user.twoFASecret %}✓{% else %}✗{% endif %}
+ {% if contact.user and contact.user.twoFASecret %}✓{% else %}✗{% endif %}
Groups: