From f937381e51c9c42618d51a3ea64a256cae7a4736 Mon Sep 17 00:00:00 2001 From: groovecoder Date: Fri, 24 May 2024 11:17:38 -0500 Subject: [PATCH] for MPP-3817: redirect inactive users to new account_inactive page --- frontend/pendingTranslations.ftl | 2 ++ .../accounts/account_inactive.module.scss | 6 ++++++ .../pages/accounts/account_inactive.page.tsx | 18 ++++++++++++++++++ privaterelay/allauth.py | 5 ++++- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 frontend/src/pages/accounts/account_inactive.module.scss create mode 100644 frontend/src/pages/accounts/account_inactive.page.tsx diff --git a/frontend/pendingTranslations.ftl b/frontend/pendingTranslations.ftl index 4121243877..2f220679b4 100644 --- a/frontend/pendingTranslations.ftl +++ b/frontend/pendingTranslations.ftl @@ -124,3 +124,5 @@ upsell-banner-4-masks-us-cta = Upgrade to { -brand-name-relay-premium } -brand-name-mozilla-monitor = Mozilla Monitor moz-monitor = { -brand-name-mozilla-monitor } + +api-error-account-is-inactive = Your account is not active. diff --git a/frontend/src/pages/accounts/account_inactive.module.scss b/frontend/src/pages/accounts/account_inactive.module.scss new file mode 100644 index 0000000000..4346c56bed --- /dev/null +++ b/frontend/src/pages/accounts/account_inactive.module.scss @@ -0,0 +1,6 @@ +@import "~@mozilla-protocol/core/protocol/css/includes/lib"; + +.error { + background-color: $color-red-60; + color: $color-white; +} diff --git a/frontend/src/pages/accounts/account_inactive.page.tsx b/frontend/src/pages/accounts/account_inactive.page.tsx new file mode 100644 index 0000000000..40c003a1a6 --- /dev/null +++ b/frontend/src/pages/accounts/account_inactive.page.tsx @@ -0,0 +1,18 @@ +import type { NextPage } from "next"; + +import { Layout } from "../../components/layout/Layout"; +import { useL10n } from "../../hooks/l10n"; +import styles from "./account_inactive.module.scss"; + +const AccountInactive: NextPage = () => { + const l10n = useL10n(); + return ( + +
+ {l10n.getString("api-error-account-is-inactive")} +
+
+ ); +}; + +export default AccountInactive; diff --git a/privaterelay/allauth.py b/privaterelay/allauth.py index 0d72246bcc..2db0478cac 100644 --- a/privaterelay/allauth.py +++ b/privaterelay/allauth.py @@ -2,7 +2,7 @@ from urllib.parse import urlencode, urlparse from django.http import Http404 -from django.shortcuts import resolve_url +from django.shortcuts import redirect, resolve_url from django.urls import resolve from allauth.account.adapter import DefaultAccountAdapter @@ -54,3 +54,6 @@ def is_safe_url(self, url: str | None) -> bool: # The path is invalid logger.error("No matching URL for '%s'", url) return False + + def respond_user_inactive(self, request, user): + return redirect("/accounts/account_inactive/")