Skip to content

Commit

Permalink
for MPP-3817: redirect inactive users to new account_inactive page
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed May 24, 2024
1 parent fa31e8a commit f937381
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/pendingTranslations.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 6 additions & 0 deletions frontend/src/pages/accounts/account_inactive.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "~@mozilla-protocol/core/protocol/css/includes/lib";

.error {
background-color: $color-red-60;
color: $color-white;
}
18 changes: 18 additions & 0 deletions frontend/src/pages/accounts/account_inactive.page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Layout>
<div className={styles["error"]}>
{l10n.getString("api-error-account-is-inactive")}
</div>
</Layout>
);
};

export default AccountInactive;
5 changes: 4 additions & 1 deletion privaterelay/allauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/")

0 comments on commit f937381

Please sign in to comment.