Skip to content

Commit

Permalink
feat: SMS TOTP support for membership login
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Mar 31, 2024
1 parent c6e698b commit 904ed1c
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 179 deletions.
21 changes: 21 additions & 0 deletions src/app/api/[chain]/user/totp/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { AppRouteHandlerFnContext, withApiAuthRequired } from "@auth0/nextjs-auth0";

import {
put,
tryUseRefreshToken,
respondUnauthorized,
respondNotFound,
doOperation,
chainIdentifierFromContext,
} from "@/lib/helpers/api";

export const PUT = withApiAuthRequired(async (req, ctx) => {
const accessToken = await tryUseRefreshToken(req);
if (!accessToken) return respondUnauthorized();

const chainIdentifier = chainIdentifierFromContext(ctx as AppRouteHandlerFnContext);
if (chainIdentifier === null) return respondNotFound();

const data = await req.text();
return await doOperation(() => put(`${chainIdentifier}/user/totp`, accessToken, data));
});
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ function ChainMembership({
>
<Tooltip title={chainProfile.name} arrow>
<RippleBadge
invisible={!hasChainUser}
invisible={chainUserLoading}
overlap="circular"
anchorOrigin={{
vertical: "bottom",
horizontal: "right",
}}
variant={"dot"}
rippleColor={"#44b700"}
rippleColor={!hasChainUser || !chainUser.isAuthVerified ? "#FF0000" : "#44b700"}
>
<Avatar
sx={{ width: { xs: 24, md: 32 }, height: { xs: 24, md: 32 } }}
Expand Down
136 changes: 0 additions & 136 deletions src/components/modals/Settings/Memberships/MembershipLogin.tsx

This file was deleted.

Loading

0 comments on commit 904ed1c

Please sign in to comment.