From fc965cd348de9d41f2b35dc64ac40be5c4ba49ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Wed, 16 Feb 2022 15:31:05 +0100 Subject: [PATCH 1/2] Site accounts improvements --- pkg/siteacc/account/manage/template.go | 25 +++++++++--------------- pkg/siteacc/account/settings/template.go | 4 ++-- pkg/siteacc/admin/template.go | 8 ++++++++ pkg/siteacc/alerting/dispatcher.go | 2 +- pkg/siteacc/data/account.go | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/pkg/siteacc/account/manage/template.go b/pkg/siteacc/account/manage/template.go index 9fe3db7f2b..9862f02009 100644 --- a/pkg/siteacc/account/manage/template.go +++ b/pkg/siteacc/account/manage/template.go @@ -34,11 +34,6 @@ function handleRequestAccess() { window.location.replace("{{getServerAddress}}/account/?path=contact&subject=" + encodeURIComponent("Request GOCDB access")); } -function handleRequestKey() { - setState(STATE_STATUS, "Redirecting to the contact form..."); - window.location.replace("{{getServerAddress}}/account/?path=contact&subject=" + encodeURIComponent("Request API key")); -} - function handleLogout() { var xhr = new XMLHttpRequest(); xhr.open("GET", "{{getServerAddress}}/logout"); @@ -63,19 +58,12 @@ const tplStyleSheet = ` html * { font-family: arial !important; } - -.apikey { - font-family: monospace !important; - background: antiquewhite; - border: 1px solid black; - padding: 2px; -} ` const tplBody = `

Hello {{.Account.FirstName}} {{.Account.LastName}},

-

On this page, you can manage your ScienceMesh user account. This includes editing your personal information, requesting an API key or access to the GOCDB and more.

+

On this page, you can manage your ScienceMesh user account. This includes editing your personal information, requesting access to the GOCDB and more.

 
@@ -92,8 +80,7 @@ const tplBody = `
Account data: -
@@ -102,10 +89,16 @@ const tplBody = `   - +
+

Quick links:

+ +
` diff --git a/pkg/siteacc/account/settings/template.go b/pkg/siteacc/account/settings/template.go index e3a2d94b69..6c3a058f2a 100644 --- a/pkg/siteacc/account/settings/template.go +++ b/pkg/siteacc/account/settings/template.go @@ -77,8 +77,8 @@ const tplBody = `
- - + +
diff --git a/pkg/siteacc/admin/template.go b/pkg/siteacc/admin/template.go index 6dccaca3df..07374f7fdc 100644 --- a/pkg/siteacc/admin/template.go +++ b/pkg/siteacc/admin/template.go @@ -68,19 +68,23 @@ const tplBody = `

+ GOCDB access: {{if .Data.GOCDBAccess}}Granted{{else}}Not granted{{end}}

+ {{if .Data.GOCDBAccess}} @@ -88,14 +92,18 @@ const tplBody = ` {{end}} + +   diff --git a/pkg/siteacc/alerting/dispatcher.go b/pkg/siteacc/alerting/dispatcher.go index b8724079a6..760849887a 100644 --- a/pkg/siteacc/alerting/dispatcher.go +++ b/pkg/siteacc/alerting/dispatcher.go @@ -67,7 +67,7 @@ func (dispatcher *Dispatcher) DispatchAlerts(alerts *template.Data, accounts dat // Dispatch the alert to all accounts configured to receive it for _, account := range accounts { - if strings.EqualFold(account.Site, siteID) && account.Settings.ReceiveAlerts { + if strings.EqualFold(account.Site, siteID) /* && account.Settings.ReceiveAlerts */ { // TODO: Uncomment if alert notifications aren't mandatory anymore if err := dispatcher.dispatchAlert(alert, account); err != nil { // Log errors only dispatcher.log.Err(err).Str("id", alert.Fingerprint).Str("recipient", account.Email).Msg("unable to dispatch alert to user") diff --git a/pkg/siteacc/data/account.go b/pkg/siteacc/data/account.go index 1279ac8bc8..7d54beea5e 100644 --- a/pkg/siteacc/data/account.go +++ b/pkg/siteacc/data/account.go @@ -214,7 +214,7 @@ func NewAccount(email string, title, firstName, lastName string, site, role stri Authorized: false, }, Settings: AccountSettings{ - ReceiveAlerts: false, + ReceiveAlerts: true, }, } From b42a16f065b8efcad1861a7ca35b1f66bc6e19a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Wed, 16 Feb 2022 15:34:33 +0100 Subject: [PATCH 2/2] Add changelog --- changelog/unreleased/siteacc-upd.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog/unreleased/siteacc-upd.md diff --git a/changelog/unreleased/siteacc-upd.md b/changelog/unreleased/siteacc-upd.md new file mode 100644 index 0000000000..4fd2ffb052 --- /dev/null +++ b/changelog/unreleased/siteacc-upd.md @@ -0,0 +1,8 @@ +Enhancement: Site accounts improvements + +This PR improves the site accounts: +- Removed/hid API key stuff +- Added quick links to the main panel +- Made alert notifications mandatory + +https://github.com/cs3org/reva/pull/2549