A full-featured CRM built with React, shadcn/ui, and Supabase.
Fix OAuth consent page for returning clients and clarify granted access
fzaninotto9071e7dcad43
diff --git a/src/components/atomic-crm/providers/commons/i18nProvider.ts b/src/components/atomic-crm/providers/commons/i18nProvider.tsindex afe4584a..37322233 100644--- a/src/components/atomic-crm/providers/commons/i18nProvider.ts+++ b/src/components/atomic-crm/providers/commons/i18nProvider.ts@@ -12,6 +12,15 @@ const raSupabaseEnglishMessagesOverride = {auth: {password_reset: "Check your emails for a Reset Password message.",},+ oauth: {+ authorize: "Authorize Application",+ authorize_details: "This application wants to access your account.",+ access_scope:+ "It will be able to read and modify your data, with the same permissions as your account.",+ approved: "Authorization Approved",+ close_tab: "You can now close this tab.",+ no_request: "No authorization request found",+ },},};@@ -21,6 +30,15 @@ const raSupabaseFrenchMessagesOverride = {password_reset:"Consultez vos emails pour trouver le message de reinitialisation du mot de passe.",},+ oauth: {+ authorize: "Autoriser l'application",+ authorize_details: "Cette application souhaite accéder à votre compte.",+ access_scope:+ "Elle pourra lire et modifier vos données, avec les mêmes droits que votre compte.",+ approved: "Autorisation accordée",+ close_tab: "Vous pouvez fermer cet onglet.",+ no_request: "Aucune demande d'autorisation trouvée",+ },},};diff --git a/src/components/supabase/oauth-consent-page.tsx b/src/components/supabase/oauth-consent-page.tsxindex a040e148..3a51d001 100644--- a/src/components/supabase/oauth-consent-page.tsx+++ b/src/components/supabase/oauth-consent-page.tsx@@ -69,6 +69,10 @@ export function OAuthConsentPage() {if (error) {setError(error.message);+ } else if ("redirect_url" in data) {+ // The user already consented to this client: skip the consent screen+ window.location.href = data.redirect_url;+ return;} else {setAuthDetails(data as OAuthAuthorizationDetails);}@@ -189,23 +193,12 @@ export function OAuthConsentPage() {<CardTitle>{authDetails.client.name}</CardTitle><CardDescription>{authDetails.redirect_uri}</CardDescription></CardHeader>- <CardContent className="space-y-4">- {authDetails.scope && authDetails.scope.length > 0 && (- <div>- <p className="text-sm font-medium text-muted-foreground mb-2">- {translate("ra-supabase.oauth.permissions", {- _: "Requested permissions",- })}- </p>- <ul className="list-disc list-inside space-y-1">- {authDetails.scope.split(" ").map((scopeItem) => (- <li key={scopeItem} className="text-sm">- {scopeItem}- </li>- ))}- </ul>- </div>- )}+ <CardContent>+ <p className="text-sm">+ {translate("ra-supabase.oauth.access_scope", {+ _: "It will be able to read and modify your data, with the same permissions as your account.",+ })}+ </p></CardContent><CardFooter className="flex gap-2"><Button