From cc050dc0a1a3313ad59542cf542307f016afb989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Mon, 6 Sep 2021 16:37:46 +0200 Subject: [PATCH 1/8] Accounts now have an associated site --- .../config/http/services/siteacc/_index.md | 24 +++++- internal/http/services/siteacc/siteacc.go | 8 ++ pkg/siteacc/account/edit/template.go | 19 +++-- pkg/siteacc/account/manage/template.go | 2 +- pkg/siteacc/account/panel.go | 29 ++++++++ pkg/siteacc/account/registration/template.go | 18 +++-- pkg/siteacc/admin/template.go | 2 +- pkg/siteacc/config/config.go | 8 +- pkg/siteacc/data/account.go | 30 ++++---- pkg/siteacc/data/sites.go | 74 +++++++++++++++++++ pkg/siteacc/html/panel.go | 5 ++ pkg/siteacc/manager/accmanager.go | 5 +- 12 files changed, 185 insertions(+), 39 deletions(-) create mode 100644 pkg/siteacc/data/sites.go diff --git a/docs/content/en/docs/config/http/services/siteacc/_index.md b/docs/content/en/docs/config/http/services/siteacc/_index.md index 6de927d5c8..bf318f18fe 100644 --- a/docs/content/en/docs/config/http/services/siteacc/_index.md +++ b/docs/content/en/docs/config/http/services/siteacc/_index.md @@ -120,12 +120,28 @@ file = "/var/reva/accounts.json" {{< /highlight >}} {{% /dir %}} -## Site registration settings +## Mentix settings {{% dir name="url" type="string" default="" %}} -The registration service URL. +The main Mentix URL. {{< highlight toml >}} -[http.services.siteacc.sitereg] -url = "https://iop.example.com/sitereg" +[http.services.siteacc.mentix] +url = "https://iop.example.com/mentix" +{{< /highlight >}} +{{% /dir %}} + +{{% dir name="data_endpoint" type="string" default="/sites" %}} +The main data endpoint of Mentix. +{{< highlight toml >}} +[http.services.siteacc.mentix] +data_endpoint = "/data" +{{< /highlight >}} +{{% /dir %}} + +{{% dir name="sitereg_endpoint" type="string" default="/sitereg" %}} +The site registration endpoint of Mentix. +{{< highlight toml >}} +[http.services.siteacc.mentix] +sitereg_endpoint = "/register" {{< /highlight >}} {{% /dir %}} diff --git a/internal/http/services/siteacc/siteacc.go b/internal/http/services/siteacc/siteacc.go index 8684964e9d..16eef4a857 100644 --- a/internal/http/services/siteacc/siteacc.go +++ b/internal/http/services/siteacc/siteacc.go @@ -89,6 +89,14 @@ func applyDefaultConfig(conf *config.Configuration) { conf.Storage.Driver = "file" } + if conf.Mentix.DataEndpoint == "" { + conf.Mentix.DataEndpoint = "/sites" + } + + if conf.Mentix.SiteRegistrationEndpoint == "" { + conf.Mentix.SiteRegistrationEndpoint = "/sitereg" + } + // Enforce a minimum session timeout of 1 minute (and default to 5 minutes) if conf.Webserver.SessionTimeout < 60 { conf.Webserver.SessionTimeout = 5 * 60 diff --git a/pkg/siteacc/account/edit/template.go b/pkg/siteacc/account/edit/template.go index 9cde9f4009..c28e6ec255 100644 --- a/pkg/siteacc/account/edit/template.go +++ b/pkg/siteacc/account/edit/template.go @@ -30,13 +30,13 @@ function verifyForm(formData) { return false; } - if (formData.getTrimmed("organization") == "") { - setState(STATE_ERROR, "Please specify your organization/company.", "form", "organization", true); + if (formData.getTrimmed("site") == "") { + setState(STATE_ERROR, "Please specify your ScienceMesh site.", "form", "site", true); return false; } if (formData.getTrimmed("role") == "") { - setState(STATE_ERROR, "Please specify your role within the organization/company.", "form", "role", true); + setState(STATE_ERROR, "Please specify your role within your site.", "form", "role", true); return false; } @@ -80,7 +80,7 @@ function handleAction(action) { "title": formData.getTrimmed("title"), "firstName": formData.getTrimmed("fname"), "lastName": formData.getTrimmed("lname"), - "organization": formData.getTrimmed("organization"), + "site": formData.getTrimmed("site"), "website": formData.getTrimmed("website"), "role": formData.getTrimmed("role"), "phoneNumber": formData.getTrimmed("phone"), @@ -127,8 +127,15 @@ const tplBody = `
-
-
+
+
+ +
diff --git a/pkg/siteacc/account/manage/template.go b/pkg/siteacc/account/manage/template.go index 6fde24cc1e..dcbe2ee8e0 100644 --- a/pkg/siteacc/account/manage/template.go +++ b/pkg/siteacc/account/manage/template.go @@ -78,7 +78,7 @@ const tplBody = `