mirror of
https://github.com/documenso/documenso.git
synced 2026-10-03 10:13:52 +10:00
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.
20 lines
545 B
TypeScript
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,
|
|
};
|
|
});
|