mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Update profile-security.tsx
This commit is contained in:
@@ -163,85 +163,81 @@ export function ProfileSecurity({
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isPasskeyEnabled ||
|
{(isPasskeyEnabled || isPasswordEnabled || user.twoFactorEnabled) && (
|
||||||
isPasswordEnabled ||
|
<div className="space-y-6">
|
||||||
(user.twoFactorEnabled && (
|
<h3 className="text-lg font-medium">Authentication</h3>
|
||||||
<div className="space-y-6">
|
<div className="border rounded-lg p-4 space-y-4">
|
||||||
<h3 className="text-lg font-medium">Authentication</h3>
|
{isPasswordEnabled && (
|
||||||
<div className="border rounded-lg p-4 space-y-4">
|
<>
|
||||||
{isPasswordEnabled && (
|
|
||||||
<>
|
|
||||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="font-medium">Password</div>
|
|
||||||
<div className="text-sm text-muted-foreground">
|
|
||||||
{user.lastChangedPasswordAt
|
|
||||||
? `Last changed ${timeAgo(new Date(user.lastChangedPasswordAt))}`
|
|
||||||
: "Never changed"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{credentialAccount ? (
|
|
||||||
<ResetPasswordProfileProviderModal
|
|
||||||
open={isPasswordDialogOpen}
|
|
||||||
onOpenChange={setIsPasswordDialogOpen}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<SetPasswordProfileProviderModal
|
|
||||||
open={isPasswordDialogOpen}
|
|
||||||
onOpenChange={setIsPasswordDialogOpen}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Separator />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{isPasswordEnabled && (
|
|
||||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="font-medium">Password</div>
|
||||||
<div className="font-medium">
|
|
||||||
Two-Factor Authentication
|
|
||||||
</div>
|
|
||||||
{user.twoFactorEnabled && (
|
|
||||||
<Badge
|
|
||||||
variant="secondary"
|
|
||||||
className="text-[10px] h-5 px-1.5 text-green-600 bg-green-500/10 border-0"
|
|
||||||
>
|
|
||||||
Active
|
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="text-sm text-muted-foreground">
|
<div className="text-sm text-muted-foreground">
|
||||||
Enhance the security of your account by requiring a second
|
{user.lastChangedPasswordAt
|
||||||
form of verification during login.
|
? `Last changed ${timeAgo(new Date(user.lastChangedPasswordAt))}`
|
||||||
|
: "Never changed"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{credentialAccount ? (
|
||||||
{user.twoFactorEnabled ? (
|
<ResetPasswordProfileProviderModal
|
||||||
<div className="flex flex-col items-center gap-2">
|
open={isPasswordDialogOpen}
|
||||||
<ViewBackupCodesModal
|
onOpenChange={setIsPasswordDialogOpen}
|
||||||
open={isBackupCodesDialogOpen}
|
/>
|
||||||
onOpenChange={setIsBackupCodesDialogOpen}
|
|
||||||
/>
|
|
||||||
<Disable2FAProfileProviderModal
|
|
||||||
open={isDisable2FADialogOpen}
|
|
||||||
onOpenChange={setIsDisable2FADialogOpen}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<Setup2FAProfileProviderModal
|
<SetPasswordProfileProviderModal
|
||||||
disabled={!credentialAccount}
|
open={isPasswordDialogOpen}
|
||||||
open={isSetup2FADialogOpen}
|
onOpenChange={setIsPasswordDialogOpen}
|
||||||
onOpenChange={setIsSetup2FADialogOpen}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
<Separator />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isPasswordEnabled && (
|
||||||
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="font-medium">Two-Factor Authentication</div>
|
||||||
|
{user.twoFactorEnabled && (
|
||||||
|
<Badge
|
||||||
|
variant="secondary"
|
||||||
|
className="text-[10px] h-5 px-1.5 text-green-600 bg-green-500/10 border-0"
|
||||||
|
>
|
||||||
|
Active
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
Enhance the security of your account by requiring a second
|
||||||
|
form of verification during login.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{user.twoFactorEnabled ? (
|
||||||
|
<div className="flex flex-col items-center gap-2">
|
||||||
|
<ViewBackupCodesModal
|
||||||
|
open={isBackupCodesDialogOpen}
|
||||||
|
onOpenChange={setIsBackupCodesDialogOpen}
|
||||||
|
/>
|
||||||
|
<Disable2FAProfileProviderModal
|
||||||
|
open={isDisable2FADialogOpen}
|
||||||
|
onOpenChange={setIsDisable2FADialogOpen}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<Setup2FAProfileProviderModal
|
||||||
|
disabled={!credentialAccount}
|
||||||
|
open={isSetup2FADialogOpen}
|
||||||
|
onOpenChange={setIsSetup2FADialogOpen}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{isPasskeyEnabled && (
|
{isPasskeyEnabled && (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user