fix: cleanup consent

This commit is contained in:
Philipinho
2026-08-26 12:48:40 +01:00
parent 1a4ed15c38
commit 2cd5b861b9
5 changed files with 8 additions and 29 deletions
@@ -1322,11 +1322,10 @@
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.",
"Something went wrong. Please try again.": "Something went wrong. Please try again.",
"Remove {{name}}": "Remove {{name}}",
"I trust this application and want to continue": "I trust this application and want to continue",
"Make sure you trust this application before authorizing it.": "Make sure you trust this application before authorizing it.",
"You will be redirected to": "You will be redirected to",
"View content without making changes.": "View content without making changes.",
"Create and modify content.": "Create and modify content.",
"Make sure you trust this application before authorizing it.": "Make sure you trust this application before authorizing it.",
"Applications and AI assistants you have authorized to access your account.": "Applications and AI assistants you have authorized to access your account.",
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.",
"Authorized apps": "Authorized apps",
@@ -20,7 +20,6 @@ import { notifications } from "@mantine/notifications";
import {
IconAlertTriangle,
IconEye,
IconInfoCircle,
IconPencil,
} from "@tabler/icons-react";
import { useQuery } from "@tanstack/react-query";
@@ -174,7 +173,6 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
info.scopes.filter((scope) => scope === "read" || scope === "write"),
);
const [submitting, setSubmitting] = useState<"approve" | "deny" | null>(null);
const [acknowledged, setAcknowledged] = useState(false);
const scopeRows = [
{
@@ -306,24 +304,10 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
<Alert
variant="light"
color="yellow"
icon={<IconInfoCircle size={16} />}
py="xs"
icon={<IconAlertTriangle size={16} />}
>
<Stack gap="xs">
<Text size="sm">
{t(
"Make sure you trust this application before authorizing it.",
)}
</Text>
<Checkbox
size="sm"
checked={acknowledged}
disabled={submitting !== null}
onChange={(event) =>
setAcknowledged(event.currentTarget.checked)
}
label={t("I trust this application and want to continue")}
/>
</Stack>
{t("Make sure you trust this application before authorizing it.")}
</Alert>
)}
@@ -339,11 +323,7 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
<Button
onClick={() => submitDecision(true)}
loading={submitting === "approve"}
disabled={
approvedScopes.length === 0 ||
(!info.verified && !acknowledged) ||
submitting === "deny"
}
disabled={approvedScopes.length === 0 || submitting === "deny"}
>
{t("Authorize")}
</Button>
@@ -51,7 +51,7 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
[ctx.getHandler(), ctx.getClass()],
);
if (requiresSession && user.authType !== JwtType.ACCESS) {
this.logger.warn(
this.logger.debug(
`session-only endpoint ${ctx.getClass()?.name}.${ctx.getHandler()?.name} refused authType ${user.authType}`,
);
throw new ForbiddenException(
@@ -92,7 +92,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
this.sessionActivityService.trackActivity(sessionId, payload.sub, payload.workspaceId);
}
return { user, workspace };
return { user, workspace, authType: JwtType.ACCESS };
}
private async validateApiKey(req: any, payload: JwtApiKeyPayload) {