Files
documenso/packages/trpc/server/auth-router/get-auth-methods.ts
T
Lucas Smith 6a99b40cba fix: improve action auth flow for passwordless users (#3358)
Selecting password auth failed with a generic "Unauthorized" for users
who signed up via OAuth or passkey, with no way to set one.

Detect the missing password and email the existing reset link from the
signing dialog and security settings. Require a 2FA code and rate limit
update-password.
2026-09-11 14:17:34 +10:00

20 lines
545 B
TypeScript

import { getUserAuthMethods } from '@documenso/lib/server-only/user/get-user-auth-methods';
import { authenticatedProcedure } from '../trpc';
import { ZGetAuthMethodsResponseSchema } from './get-auth-methods.types';
/**
* Get the sign in methods available to the current user.
*/
export const getAuthMethodsRoute = authenticatedProcedure
.output(ZGetAuthMethodsResponseSchema)
.query(async ({ ctx }) => {
const authMethods = await getUserAuthMethods({
userId: ctx.user.id,
});
return {
authMethods,
};
});