امنیتِ حساب
پیشنمایش تمامصفحهامنیت: امتیازِ امنیت با کارِ پیشنهادی، ورودِ دومرحلهای با سوییچ، رمز با تاریخِ آخرین تغییر و دستگاههای فعال با خروجِ تکی یا همه (با تأیید).
۱. نصب کامپوننتها
این بلاک از ۱۰ آیتم دیگ استفاده میکند: alert-dialogbadgebuttoncardcontrol-sizeiconslabelpersianswitchtoast
npx digdesign@latest add https://docs.digdesign.ir/r/alert-dialog.json https://docs.digdesign.ir/r/badge.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/card.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/switch.json https://docs.digdesign.ir/r/toast.jsonpnpm dlx digdesign@latest add https://docs.digdesign.ir/r/alert-dialog.json https://docs.digdesign.ir/r/badge.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/card.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/switch.json https://docs.digdesign.ir/r/toast.jsonyarn dlx digdesign@latest add https://docs.digdesign.ir/r/alert-dialog.json https://docs.digdesign.ir/r/badge.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/card.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/switch.json https://docs.digdesign.ir/r/toast.jsonbunx --bun digdesign@latest add https://docs.digdesign.ir/r/alert-dialog.json https://docs.digdesign.ir/r/badge.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/card.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json https://docs.digdesign.ir/r/label.json https://docs.digdesign.ir/r/persian.json https://docs.digdesign.ir/r/switch.json https://docs.digdesign.ir/r/toast.jsonnpx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework vuepnpm dlx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework vueyarn dlx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework vuebunx --bun digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework vuenpx digdesign@latest add button --framework sveltepnpm dlx digdesign@latest add button --framework svelteyarn dlx digdesign@latest add button --framework sveltebunx --bun digdesign@latest add button --framework sveltenpx digdesign@latest add alert-dialog badge button card control-size icons label persian switch toast --framework angularpnpm dlx digdesign@latest add alert-dialog badge button card control-size icons label persian switch toast --framework angularyarn dlx digdesign@latest add alert-dialog badge button card control-size icons label persian switch toast --framework angularbunx --bun digdesign@latest add alert-dialog badge button card control-size icons label persian switch toast --framework angularnpx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework androidpnpm dlx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework androidyarn dlx digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework androidbunx --bun digdesign@latest add alert-dialog badge button card control-size label persian switch toast --framework android۲. کد صفحه
کد را در صفحهٔ پروژهتان بگذارید (React: app/<route>/page.tsx) و متنها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریمورک کدِ همین صفحه در فریمورک دیگر را ببینید.
"use client"
import * as React from "react"
import { GlobeIcon, MobileIcon, ShieldCheckIcon } from "@/components/icons"
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"
import { toast } from "@/components/ui/toast"
import { formatRelativeTime } from "@/lib/persian"
type Session = { id: string; device: string; place: string; at: string; mobile: boolean; current?: boolean }
const SESSIONS: Session[] = [
{ id: "1", device: "کروم روی مک", place: "تهران", at: "2026-10-06T09:10:00", mobile: false, current: true },
{ id: "2", device: "اپِ آوند، آیفون", place: "تهران", at: "2026-10-05T21:40:00", mobile: true },
{ id: "3", device: "فایرفاکس روی ویندوز", place: "اصفهان", at: "2026-09-28T13:05:00", mobile: false },
]
/**
* امنیتِ حساب: نوارِ امتیازِ امنیت با کارِ بعدی پیشنهادی، ورودِ دومرحلهای با کلید و
* توضیح، رمز با تاریخِ آخرین تغییر، و دستگاههای فعال با خروجِ تکی یا همه (با تأیید).
*/
export default function AccountSecurityBlock() {
const [twoFactor, setTwoFactor] = React.useState(false)
const [sessions, setSessions] = React.useState(SESSIONS)
const score = twoFactor ? 100 : 60
return (
<ControlSizeProvider size="xl" asChild>
<main className="mx-auto flex w-full max-w-3xl flex-col gap-8 p-4 sm:p-6">
<header className="flex flex-col gap-1">
<h1 className="text-2xl font-bold">امنیتِ حساب</h1>
<p className="text-muted-foreground">رمز، ورودِ دومرحلهای و دستگاههایی که با آنها وارد شدهای.</p>
</header>
<section aria-label="وضعیتِ امنیت" className={`flex items-center gap-4 rounded-xl p-5 ${twoFactor ? "bg-success-subtle" : "bg-[color-mix(in_oklab,var(--dig-orange-500)_12%,var(--background))]"}`}>
<span aria-hidden className={`flex size-12 shrink-0 items-center justify-center rounded-xl bg-card [&>svg]:size-6 ${twoFactor ? "text-success-subtle-foreground" : "text-[var(--dig-orange-600)]"}`}>
<ShieldCheckIcon />
</span>
<div className="flex flex-1 flex-col gap-0.5">
<span className="font-bold">{twoFactor ? "حسابت کاملاً امن است" : "یک قدم تا امنیتِ کامل"}</span>
<span className="text-sm text-muted-foreground">{twoFactor ? "ورودِ دومرحلهای روشن است." : "ورودِ دومرحلهای را روشن کن تا رمزِ لورفته هم کافی نباشد."}</span>
</div>
<span className="text-2xl font-black tabular-nums">{score === 100 ? "۱۰۰٪" : "۶۰٪"}</span>
</section>
<Card>
<CardContent className="flex flex-col divide-y divide-border">
<div className="flex items-start justify-between gap-4 pb-5">
<div className="flex flex-col gap-1">
<Label htmlFor="two-factor" className="font-semibold">
ورودِ دومرحلهای
</Label>
<span className="text-sm leading-6 text-muted-foreground">بعد از رمز، یک کدِ پیامکی هم لازم میشود.</span>
</div>
<Switch
id="two-factor"
checked={twoFactor}
onCheckedChange={(checked) => {
setTwoFactor(checked)
toast.success(checked ? "ورودِ دومرحلهای روشن شد." : "ورودِ دومرحلهای خاموش شد.")
}}
/>
</div>
<div className="flex items-center justify-between gap-4 pt-5">
<div className="flex flex-col gap-1">
<span className="font-semibold">رمز عبور</span>
<span className="text-sm text-muted-foreground">آخرین تغییر {formatRelativeTime("2026-06-12T10:00:00")}</span>
</div>
<Button variant="outline">تغییرِ رمز</Button>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="text-base">دستگاههای فعال</CardTitle>
<CardDescription>دستگاهی را نمیشناسی؟ همین حالا از آن خارج شو.</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-6">
<ul className="flex flex-col divide-y divide-border">
{sessions.map((session) => (
<li key={session.id} className="flex items-center gap-4 py-4 first:pt-0 last:pb-0">
<span aria-hidden className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-subtle [&>svg]:size-5">
{session.mobile ? <MobileIcon /> : <GlobeIcon />}
</span>
<span className="flex flex-1 flex-col gap-0.5">
<span className="flex items-center gap-2 font-medium">
{session.device}
{session.current && (
<Badge variant="soft" color="success">
همین دستگاه
</Badge>
)}
</span>
<span className="text-sm text-muted-foreground">
{session.place} · {session.current ? "الان" : formatRelativeTime(session.at)}
</span>
</span>
{!session.current && (
<Button variant="ghost" color="destructive" onClick={() => setSessions((list) => list.filter((item) => item.id !== session.id))}>
خروج
</Button>
)}
</li>
))}
</ul>
{sessions.length > 1 && (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline" color="destructive" className="self-start">
خروج از همهٔ دستگاههای دیگر
</Button>
</AlertDialogTrigger>
<ControlSizeProvider size="xl" asChild>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>از {sessions.length - 1 === 1 ? "یک دستگاهِ دیگر" : "همهٔ دستگاههای دیگر"} خارج شوی؟</AlertDialogTitle>
<AlertDialogDescription>روی آن دستگاهها باید دوباره وارد شوی. همین دستگاه وصل میماند.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>انصراف</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
setSessions((list) => list.filter((item) => item.current))
toast.success("از دستگاههای دیگر خارج شدی.")
}}
>
خروج از همه
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</ControlSizeProvider>
</AlertDialog>
)}
</CardContent>
</Card>
</main>
</ControlSizeProvider>
)
}
<script setup lang="ts">
import { computed, ref } from "vue"
import AlertDialog from "@/components/ui/AlertDialog.vue"
import AlertDialogAction from "@/components/ui/AlertDialogAction.vue"
import AlertDialogCancel from "@/components/ui/AlertDialogCancel.vue"
import AlertDialogContent from "@/components/ui/AlertDialogContent.vue"
import AlertDialogDescription from "@/components/ui/AlertDialogDescription.vue"
import AlertDialogFooter from "@/components/ui/AlertDialogFooter.vue"
import AlertDialogHeader from "@/components/ui/AlertDialogHeader.vue"
import AlertDialogTitle from "@/components/ui/AlertDialogTitle.vue"
import AlertDialogTrigger from "@/components/ui/AlertDialogTrigger.vue"
import Badge from "@/components/ui/Badge.vue"
import Button from "@/components/ui/Button.vue"
import Card from "@/components/ui/Card.vue"
import CardContent from "@/components/ui/CardContent.vue"
import CardDescription from "@/components/ui/CardDescription.vue"
import CardHeader from "@/components/ui/CardHeader.vue"
import CardTitle from "@/components/ui/CardTitle.vue"
import ControlSize from "@/components/ui/ControlSize.vue"
import Label from "@/components/ui/Label.vue"
import Switch from "@/components/ui/Switch.vue"
import { toast } from "@/components/ui/Toast.vue"
import { DigIcon } from "@/lib/icons"
import { formatRelativeTime } from "@/lib/persian"
type Session = { id: string; device: string; place: string; at: string; mobile: boolean; current?: boolean }
const SESSIONS: Session[] = [
{ id: "1", device: "کروم روی مک", place: "تهران", at: "2026-10-06T09:10:00", mobile: false, current: true },
{ id: "2", device: "اپِ آوند، آیفون", place: "تهران", at: "2026-10-05T21:40:00", mobile: true },
{ id: "3", device: "فایرفاکس روی ویندوز", place: "اصفهان", at: "2026-09-28T13:05:00", mobile: false },
]
/**
* امنیتِ حساب: نوارِ امتیازِ امنیت با کارِ بعدی پیشنهادی، ورودِ دومرحلهای با کلید و
* توضیح، رمز با تاریخِ آخرین تغییر، و دستگاههای فعال با خروجِ تکی یا همه (با تأیید).
*/
const twoFactor = ref(false)
const sessions = ref<Session[]>(SESSIONS)
const score = computed(() => (twoFactor.value ? 100 : 60))
function onTwoFactor(checked: boolean) {
twoFactor.value = checked
toast.success(checked ? "ورودِ دومرحلهای روشن شد." : "ورودِ دومرحلهای خاموش شد.")
}
function logoutOthers() {
sessions.value = sessions.value.filter((item) => item.current)
toast.success("از دستگاههای دیگر خارج شدی.")
}
</script>
<template>
<ControlSize size="xl" as-child>
<main class="mx-auto flex w-full max-w-3xl flex-col gap-8 p-4 sm:p-6">
<header class="flex flex-col gap-1">
<h1 class="text-2xl font-bold">امنیتِ حساب</h1>
<p class="text-muted-foreground">رمز، ورودِ دومرحلهای و دستگاههایی که با آنها وارد شدهای.</p>
</header>
<section aria-label="وضعیتِ امنیت" :class="`flex items-center gap-4 rounded-xl p-5 ${twoFactor ? 'bg-success-subtle' : 'bg-[color-mix(in_oklab,var(--dig-orange-500)_12%,var(--background))]'}`">
<span aria-hidden="true" :class="`flex size-12 shrink-0 items-center justify-center rounded-xl bg-card [&>svg]:size-6 ${twoFactor ? 'text-success-subtle-foreground' : 'text-[var(--dig-orange-600)]'}`">
<DigIcon name="shield-check" />
</span>
<div class="flex flex-1 flex-col gap-0.5">
<span class="font-bold">{{ twoFactor ? "حسابت کاملاً امن است" : "یک قدم تا امنیتِ کامل" }}</span>
<span class="text-sm text-muted-foreground">{{ twoFactor ? "ورودِ دومرحلهای روشن است." : "ورودِ دومرحلهای را روشن کن تا رمزِ لورفته هم کافی نباشد." }}</span>
</div>
<span class="text-2xl font-black tabular-nums">{{ score === 100 ? "۱۰۰٪" : "۶۰٪" }}</span>
</section>
<Card>
<CardContent class="flex flex-col divide-y divide-border">
<div class="flex items-start justify-between gap-4 pb-5">
<div class="flex flex-col gap-1">
<Label for="two-factor" class="font-semibold">ورودِ دومرحلهای</Label>
<span class="text-sm leading-6 text-muted-foreground">بعد از رمز، یک کدِ پیامکی هم لازم میشود.</span>
</div>
<Switch id="two-factor" :checked="twoFactor" @update:checked="onTwoFactor" />
</div>
<div class="flex items-center justify-between gap-4 pt-5">
<div class="flex flex-col gap-1">
<span class="font-semibold">رمز عبور</span>
<span class="text-sm text-muted-foreground">آخرین تغییر {{ formatRelativeTime("2026-06-12T10:00:00") }}</span>
</div>
<Button variant="outline">تغییرِ رمز</Button>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle class="text-base">دستگاههای فعال</CardTitle>
<CardDescription>دستگاهی را نمیشناسی؟ همین حالا از آن خارج شو.</CardDescription>
</CardHeader>
<CardContent class="flex flex-col gap-6">
<ul class="flex flex-col divide-y divide-border">
<li v-for="session in sessions" :key="session.id" class="flex items-center gap-4 py-4 first:pt-0 last:pb-0">
<span aria-hidden="true" class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-subtle [&>svg]:size-5">
<DigIcon :name="session.mobile ? 'mobile' : 'globe'" />
</span>
<span class="flex flex-1 flex-col gap-0.5">
<span class="flex items-center gap-2 font-medium">
{{ session.device }}
<Badge v-if="session.current" variant="soft" color="success">همین دستگاه</Badge>
</span>
<span class="text-sm text-muted-foreground">{{ session.place }} · {{ session.current ? "الان" : formatRelativeTime(session.at) }}</span>
</span>
<Button v-if="!session.current" variant="ghost" color="destructive" @click="sessions = sessions.filter((item) => item.id !== session.id)">خروج</Button>
</li>
</ul>
<AlertDialog v-if="sessions.length > 1">
<AlertDialogTrigger as-child>
<Button variant="outline" color="destructive" class="self-start">خروج از همهٔ دستگاههای دیگر</Button>
</AlertDialogTrigger>
<ControlSize size="xl" as-child>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>از {{ sessions.length - 1 === 1 ? "یک دستگاهِ دیگر" : "همهٔ دستگاههای دیگر" }} خارج شوی؟</AlertDialogTitle>
<AlertDialogDescription>روی آن دستگاهها باید دوباره وارد شوی. همین دستگاه وصل میماند.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>انصراف</AlertDialogCancel>
<AlertDialogAction @click="logoutOthers">خروج از همه</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</ControlSize>
</AlertDialog>
</CardContent>
</Card>
</main>
</ControlSize>
</template>
کدِ این بلاک هنوز برای Svelte نوشته نشده است.
این موارد هنوز برای Svelte آماده نیستند: alert-dialogbadgecardcontrol-sizelabelpersianswitchtoastآیکون globeآیکون mobileآیکون shield-check
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="svelte" ایجنت آن را با کامپوننتهای Svelte میسازد.
import { Component, ChangeDetectionStrategy, signal, computed } from "@angular/core"
import { DigControlSize } from "@/components/ui/control-size"
import { DigIcon } from "@/lib/icons"
import { DigCard, DigCardContent, DigCardHeader, DigCardTitle, DigCardDescription } from "@/components/ui/card"
import { DigLabel } from "@/components/ui/label"
import { DigSwitch } from "@/components/ui/switch"
import { DigButton } from "@/components/ui/button"
import { DigBadge } from "@/components/ui/badge"
import {
DigAlertDialog,
DigAlertDialogTrigger,
DigAlertDialogContent,
DigAlertDialogHeader,
DigAlertDialogTitle,
DigAlertDialogDescription,
DigAlertDialogFooter,
DigAlertDialogCancel,
DigAlertDialogAction,
} from "@/components/ui/alert-dialog"
import { toast } from "@/components/ui/toast"
import { formatRelativeTime } from "@/lib/persian"
type Session = {
id: string
device: string
place: string
at: string
mobile: boolean
current?: boolean
}
const SESSIONS: Session[] = [
{
id: "1",
device: "کروم روی مک",
place: "تهران",
at: "2026-10-06T09:10:00",
mobile: false,
current: true,
},
{
id: "2",
device: "اپِ آوند، آیفون",
place: "تهران",
at: "2026-10-05T21:40:00",
mobile: true,
},
{
id: "3",
device: "فایرفاکس روی ویندوز",
place: "اصفهان",
at: "2026-09-28T13:05:00",
mobile: false,
},
]
@Component({
selector: "dig-block-account-security",
imports: [
DigControlSize,
DigIcon,
DigCard,
DigCardContent,
DigCardHeader,
DigCardTitle,
DigCardDescription,
DigLabel,
DigSwitch,
DigButton,
DigBadge,
DigAlertDialog,
DigAlertDialogTrigger,
DigAlertDialogContent,
DigAlertDialogHeader,
DigAlertDialogTitle,
DigAlertDialogDescription,
DigAlertDialogFooter,
DigAlertDialogCancel,
DigAlertDialogAction,
],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<main digControlSize="xl" class="mx-auto flex w-full max-w-3xl flex-col gap-8 p-4 sm:p-6">
<header class="flex flex-col gap-1">
<h1 class="text-2xl font-bold">امنیتِ حساب</h1>
<p class="text-muted-foreground">رمز، ورودِ دومرحلهای و دستگاههایی که با آنها وارد شدهای.</p>
</header>
<section
aria-label="وضعیتِ امنیت"
[class]="\`flex items-center gap-4 rounded-xl p-5 \${twoFactor() ? 'bg-success-subtle' : 'bg-[color-mix(in_oklab,var(--dig-orange-500)_12%,var(--background))]'}\`"
>
<span
aria-hidden="true"
[class]="\`flex size-12 shrink-0 items-center justify-center rounded-xl bg-card [&>svg]:size-6 \${twoFactor() ? 'text-success-subtle-foreground' : 'text-[var(--dig-orange-600)]'}\`"
><svg digIcon="shield-check"></svg
></span>
<div class="flex flex-1 flex-col gap-0.5">
<span class="font-bold">{{ twoFactor() ? "حسابت کاملاً امن است" : "یک قدم تا امنیتِ کامل" }}</span>
<span class="text-sm text-muted-foreground">{{
twoFactor() ? "ورودِ دومرحلهای روشن است." : "ورودِ دومرحلهای را روشن کن تا رمزِ لورفته هم کافی نباشد."
}}</span>
</div>
<span class="text-2xl font-black tabular-nums">{{ score() === 100 ? "۱۰۰٪" : "۶۰٪" }}</span>
</section>
<div digCard>
<div digCardContent class="flex flex-col divide-y divide-border">
<div class="flex items-start justify-between gap-4 pb-5">
<div class="flex flex-col gap-1">
<label digLabel for="two-factor" class="font-semibold">ورودِ دومرحلهای</label>
<span class="text-sm leading-6 text-muted-foreground">بعد از رمز، یک کدِ پیامکی هم لازم میشود.</span>
</div>
<button digSwitch id="two-factor" [checked]="twoFactor()" (checkedChange)="onTwoFactor($event)"></button>
</div>
<div class="flex items-center justify-between gap-4 pt-5">
<div class="flex flex-col gap-1">
<span class="font-semibold">رمز عبور</span>
<span class="text-sm text-muted-foreground"
>آخرین تغییر {{ formatRelativeTime("2026-06-12T10:00:00") }}</span
>
</div>
<button digButton type="button" variant="outline">تغییرِ رمز</button>
</div>
</div>
</div>
<div digCard>
<div digCardHeader>
<div digCardTitle class="text-base">دستگاههای فعال</div>
<div digCardDescription>دستگاهی را نمیشناسی؟ همین حالا از آن خارج شو.</div>
</div>
<div digCardContent class="flex flex-col gap-6">
<ul class="flex flex-col divide-y divide-border">
@for (session of sessions(); track session.id) {
<li class="flex items-center gap-4 py-4 first:pt-0 last:pb-0">
<span
aria-hidden="true"
class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-subtle [&>svg]:size-5"
><svg [digIcon]="session.mobile ? 'mobile' : 'globe'"></svg
></span>
<span class="flex flex-1 flex-col gap-0.5"
><span class="flex items-center gap-2 font-medium"
>{{ session.device }}
@if (session.current) {
<span digBadge variant="soft" color="success">همین دستگاه</span>
}
</span>
<span class="text-sm text-muted-foreground"
>{{ session.place }} · {{ session.current ? "الان" : formatRelativeTime(session.at) }}</span
></span
>
@if (!session.current) {
<button
digButton
type="button"
variant="ghost"
color="destructive"
(click)="sessions.set(sessions().filter((item) => item.id !== session.id))"
>
خروج
</button>
}
</li>
}
</ul>
@if (sessions().length > 1) {
<ng-container digAlertDialog
><button
digAlertDialogTrigger
digButton
type="button"
variant="outline"
color="destructive"
class="self-start"
>
خروج از همهٔ دستگاههای دیگر
</button>
<div digControlSize="xl">
<div digAlertDialogContent>
<div digAlertDialogHeader>
<h2 digAlertDialogTitle>
از
{{ sessions().length - 1 === 1 ? "یک دستگاهِ دیگر" : "همهٔ دستگاههای دیگر" }}
خارج شوی؟
</h2>
<p digAlertDialogDescription>روی آن دستگاهها باید دوباره وارد شوی. همین دستگاه وصل میماند.</p>
</div>
<div digAlertDialogFooter>
<button digAlertDialogCancel>انصراف</button>
<button digAlertDialogAction (click)="logoutOthers()">خروج از همه</button>
</div>
</div>
</div></ng-container
>
}
</div>
</div>
</main>
`,
})
export class AccountSecurityBlock {
readonly formatRelativeTime = formatRelativeTime
readonly twoFactor = signal(false)
readonly sessions = signal<Session[]>(SESSIONS)
readonly score = computed(() => (this.twoFactor() ? 100 : 60))
onTwoFactor(checked: boolean) {
this.twoFactor.set(checked)
toast.success(checked ? "ورودِ دومرحلهای روشن شد." : "ورودِ دومرحلهای خاموش شد.")
}
logoutOthers() {
this.sessions.set(this.sessions().filter((item) => item.current))
toast.success("از دستگاههای دیگر خارج شدی.")
}
}
کدِ این بلاک هنوز برای Android نوشته نشده است.
همهٔ کامپوننتهای لازم برای Android آمادهاند؛ با MCP میتوانید همین صفحه را از روی نسخهٔ React بسازید.
کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="android" ایجنت آن را با کامپوننتهای Android میسازد.