Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Doc

Manav Rathia4e09a40e8df
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index 02ddef5ba7..e08212a46a 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -42,7 +42,7 @@ import { configureSRP } from "../services/srp";
import type { SRPAttributes, SRPSetupAttributes } from "../services/srp-remote";
import { getSRPAttributes } from "../services/srp-remote";
import type { UserVerificationResponse } from "../services/user";
-import { putAttributes, sendOTT, verifyOtt } from "../services/user";
+import { putAttributes, sendOTT, verifyEmail } from "../services/user";
import type { PageProps } from "../types/page";
const Page: React.FC<PageProps> = ({ appContext }) => {
@@ -81,8 +81,10 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
) => {
try {
const referralSource = getLocalReferralSource()?.trim();
- const cleanedReferral = referralSource ? `web:${referralSource}` : undefined;
- const resp = await verifyOtt(email, ott, cleanedReferral);
+ const cleanedReferral = referralSource
+ ? `web:${referralSource}`
+ : undefined;
+ const resp = await verifyEmail(email, ott, cleanedReferral);
const {
keyAttributes,
encryptedToken,
diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.ts
index 7a9603ee5e..500a1a6977 100644
--- a/web/packages/accounts/services/user.ts
+++ b/web/packages/accounts/services/user.ts
@@ -83,7 +83,19 @@ export const sendOTT = async (
}),
);
-export const verifyOtt = async (
+/**
+ * Verify user's access to the given {@link email} by comparing the OTT that
+ * remote previously sent to that email.
+ *
+ * @param email The email to verify.
+ *
+ * @param ott The OTT that the user entered.
+ *
+ * @param source During signup, we ask the user the referral "source" through
+ * which they heard about Ente. When present (i.e. during signup, and if the
+ * user indeed provided it), that source should be passed as this parameter.
+ */
+export const verifyEmail = async (
email: string,
ott: string,
source: string | undefined,