+ This should have been taken care of when onboarding your account, but due to a earlier
+ bug in the registration, a small subsection of accounts ended up in this state.
+
+
+ Please complete the form to give your consent, that may resolve the matter.
+
+ If it does not, please contact support so we may help you.
+
+
+
Consent & Privacy
+
)
@@ -167,32 +178,35 @@ export const RoleBlock = ({ children, user = false, Link = false }) => {
* Avoid hydration errors
*/
useEffect(() => {
- if (admin?.account?.username && account?.username)
+ if (admin?.account?.username && account?.username && !impersonating.admin)
setImpersonating({
admin: admin.account.username,
user: account.username,
})
+ }, [admin])
+
+ useEffect(() => {
const verifyUser = async () => {
- const [status, data] = await backend.ping()
- if (status === 200 && data.result === 'success') {
- // Refresh account in local storage
- setAccount({
- ...account,
- ...data.account,
- bestBefore: Date.now() + 3600000,
- })
- } else {
- if (data?.error?.error) setError(data.error.error)
+ if (!error) {
+ const [status, data] = await backend.ping()
+ if (status === 200 && data.result === 'success') {
+ // Refresh account in local storage
+ setAccount({
+ ...account,
+ ...data.account,
+ bestBefore: Date.now() + 3600000,
+ })
+ } else if (status === 451) setError('consentLacking')
else {
- signOut()
+ console.log({ status, data })
+ if (data?.error?.error) setError(data.error.error)
+ else signOut()
}
+ setReady(true)
}
- setReady(true)
- }
- if (token) {
- // Don't hammer the backend. Check once per hour.
- if (!account.bestBefore || account.bestBefore < Date.now()) verifyUser()
}
+ // Don't hammer the backend. Check once per hour.
+ if (token && !error && (!account.bestBefore || account.bestBefore < Date.now())) verifyUser()
setReady(true)
}, [admin, refreshCount, signOut])
@@ -201,7 +215,7 @@ export const RoleBlock = ({ children, user = false, Link = false }) => {
setError(false)
}
- if (!ready) return
+ if (!ready)
const banner = impersonating ? (
diff --git a/sites/org/docs/account/index.mdx b/sites/org/docs/account/index.mdx
index 9585bae11ee..2f5e4a4b119 100644
--- a/sites/org/docs/account/index.mdx
+++ b/sites/org/docs/account/index.mdx
@@ -3,10 +3,13 @@ title: Your Account
sidebar_label: Account
---
+import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
import { RoleBlock } from '@freesewing/react/components/Role'
import { Links as AccountLinks } from '@freesewing/react/components/Account'
import Link from '@docusaurus/Link'
-
-
-
+
+
+
+
+