mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
fix: visibility of security fields using identityprovider (#709)
fixes #690
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { IDENTITY_PROVIDER_NAME } from '@documenso/lib/constants/auth';
|
||||||
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
|
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
|
||||||
|
|
||||||
import { AuthenticatorApp } from '~/components/forms/2fa/authenticator-app';
|
import { AuthenticatorApp } from '~/components/forms/2fa/authenticator-app';
|
||||||
@ -17,28 +18,43 @@ export default async function SecuritySettingsPage() {
|
|||||||
|
|
||||||
<hr className="my-4" />
|
<hr className="my-4" />
|
||||||
|
|
||||||
<PasswordForm user={user} className="max-w-xl" />
|
{user.identityProvider === 'DOCUMENSO' ? (
|
||||||
|
<div>
|
||||||
|
<PasswordForm user={user} className="max-w-xl" />
|
||||||
|
|
||||||
<hr className="mb-4 mt-8" />
|
<hr className="mb-4 mt-8" />
|
||||||
|
|
||||||
<h4 className="text-lg font-medium">Two Factor Authentication</h4>
|
<h4 className="text-lg font-medium">Two Factor Authentication</h4>
|
||||||
|
|
||||||
<p className="text-muted-foreground mt-2 text-sm">
|
<p className="text-muted-foreground mt-2 text-sm">
|
||||||
Add and manage your two factor security settings to add an extra layer of security to your
|
Add and manage your two factor security settings to add an extra layer of security to
|
||||||
account!
|
your account!
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="mt-4 max-w-xl">
|
<div className="mt-4 max-w-xl">
|
||||||
<h5 className="font-medium">Two-factor methods</h5>
|
<h5 className="font-medium">Two-factor methods</h5>
|
||||||
|
|
||||||
<AuthenticatorApp isTwoFactorEnabled={user.twoFactorEnabled} />
|
<AuthenticatorApp isTwoFactorEnabled={user.twoFactorEnabled} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{user.twoFactorEnabled && (
|
{user.twoFactorEnabled && (
|
||||||
<div className="mt-4 max-w-xl">
|
<div className="mt-4 max-w-xl">
|
||||||
<h5 className="font-medium">Recovery methods</h5>
|
<h5 className="font-medium">Recovery methods</h5>
|
||||||
|
|
||||||
<RecoveryCodes isTwoFactorEnabled={user.twoFactorEnabled} />
|
<RecoveryCodes isTwoFactorEnabled={user.twoFactorEnabled} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
<h4 className="text-lg font-medium">
|
||||||
|
Your account is managed by {IDENTITY_PROVIDER_NAME[user.identityProvider]}
|
||||||
|
</h4>
|
||||||
|
<p className="text-muted-foreground mt-2 text-sm">
|
||||||
|
To update your password, enable two-factor authentication, and manage other security
|
||||||
|
settings, please go to your {IDENTITY_PROVIDER_NAME[user.identityProvider]} account
|
||||||
|
settings.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
|
import { IdentityProvider } from '@documenso/prisma/client';
|
||||||
|
|
||||||
export const SALT_ROUNDS = 12;
|
export const SALT_ROUNDS = 12;
|
||||||
|
|
||||||
|
export const IDENTITY_PROVIDER_NAME: { [key in IdentityProvider]: string } = {
|
||||||
|
[IdentityProvider.DOCUMENSO]: 'Documenso',
|
||||||
|
[IdentityProvider.GOOGLE]: 'Google',
|
||||||
|
};
|
||||||
|
|
||||||
export const IS_GOOGLE_SSO_ENABLED = Boolean(
|
export const IS_GOOGLE_SSO_ENABLED = Boolean(
|
||||||
process.env.NEXT_PRIVATE_GOOGLE_CLIENT_ID && process.env.NEXT_PRIVATE_GOOGLE_CLIENT_SECRET,
|
process.env.NEXT_PRIVATE_GOOGLE_CLIENT_ID && process.env.NEXT_PRIVATE_GOOGLE_CLIENT_SECRET,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user