mirror of
https://github.com/docmost/docmost.git
synced 2026-08-28 17:27:06 +08:00
fix: cleanup consent
This commit is contained in:
@@ -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.",
|
"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.",
|
"Something went wrong. Please try again.": "Something went wrong. Please try again.",
|
||||||
"Remove {{name}}": "Remove {{name}}",
|
"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",
|
"You will be redirected to": "You will be redirected to",
|
||||||
"View content without making changes.": "View content without making changes.",
|
"View content without making changes.": "View content without making changes.",
|
||||||
"Create and modify content.": "Create and modify content.",
|
"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.",
|
"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.",
|
"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",
|
"Authorized apps": "Authorized apps",
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { notifications } from "@mantine/notifications";
|
|||||||
import {
|
import {
|
||||||
IconAlertTriangle,
|
IconAlertTriangle,
|
||||||
IconEye,
|
IconEye,
|
||||||
IconInfoCircle,
|
|
||||||
IconPencil,
|
IconPencil,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -174,7 +173,6 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
|
|||||||
info.scopes.filter((scope) => scope === "read" || scope === "write"),
|
info.scopes.filter((scope) => scope === "read" || scope === "write"),
|
||||||
);
|
);
|
||||||
const [submitting, setSubmitting] = useState<"approve" | "deny" | null>(null);
|
const [submitting, setSubmitting] = useState<"approve" | "deny" | null>(null);
|
||||||
const [acknowledged, setAcknowledged] = useState(false);
|
|
||||||
|
|
||||||
const scopeRows = [
|
const scopeRows = [
|
||||||
{
|
{
|
||||||
@@ -306,24 +304,10 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
|
|||||||
<Alert
|
<Alert
|
||||||
variant="light"
|
variant="light"
|
||||||
color="yellow"
|
color="yellow"
|
||||||
icon={<IconInfoCircle size={16} />}
|
py="xs"
|
||||||
|
icon={<IconAlertTriangle size={16} />}
|
||||||
>
|
>
|
||||||
<Stack gap="xs">
|
{t("Make sure you trust this application before authorizing it.")}
|
||||||
<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>
|
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -339,11 +323,7 @@ function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
|
|||||||
<Button
|
<Button
|
||||||
onClick={() => submitDecision(true)}
|
onClick={() => submitDecision(true)}
|
||||||
loading={submitting === "approve"}
|
loading={submitting === "approve"}
|
||||||
disabled={
|
disabled={approvedScopes.length === 0 || submitting === "deny"}
|
||||||
approvedScopes.length === 0 ||
|
|
||||||
(!info.verified && !acknowledged) ||
|
|
||||||
submitting === "deny"
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{t("Authorize")}
|
{t("Authorize")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
|||||||
[ctx.getHandler(), ctx.getClass()],
|
[ctx.getHandler(), ctx.getClass()],
|
||||||
);
|
);
|
||||||
if (requiresSession && user.authType !== JwtType.ACCESS) {
|
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}`,
|
`session-only endpoint ${ctx.getClass()?.name}.${ctx.getHandler()?.name} refused authType ${user.authType}`,
|
||||||
);
|
);
|
||||||
throw new ForbiddenException(
|
throw new ForbiddenException(
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
|||||||
this.sessionActivityService.trackActivity(sessionId, payload.sub, payload.workspaceId);
|
this.sessionActivityService.trackActivity(sessionId, payload.sub, payload.workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { user, workspace };
|
return { user, workspace, authType: JwtType.ACCESS };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async validateApiKey(req: any, payload: JwtApiKeyPayload) {
|
private async validateApiKey(req: any, payload: JwtApiKeyPayload) {
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: 70fdfb9933...acae98e819
Reference in New Issue
Block a user