Skip to content

Commit

Permalink
Merge pull request #183 from desci-labs/hotfix-email
Browse files Browse the repository at this point in the history
hotfix email verification
  • Loading branch information
hubsmoke authored Jan 3, 2024
2 parents f5952ac + fded4d3 commit 7d79aed
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ jobs:
- name: Verify EKS Deployment (DEV)
if: github.ref == 'refs/heads/develop'
run: |
kubectl apply -f desci-server/kubernetes/deployment_dev.yaml
kubectl rollout status deployment/desci-server-dev
- name: Verify EKS Deployment (DEMO)
Expand All @@ -206,5 +205,4 @@ jobs:
- name: Verify EKS Deployment (PROD)
if: github.ref == 'refs/heads/main'
run: |
kubectl apply -f desci-server/kubernetes/deployment.yaml
kubectl rollout status deployment/desci-server
12 changes: 6 additions & 6 deletions desci-contracts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3062,9 +3062,9 @@ concat-stream@^1.5.1, concat-stream@^1.6.0, concat-stream@^1.6.2, concat-stream@
readable-stream "^2.2.2"
typedarray "^0.0.6"

"concat-stream@github:maxogden/concat-stream#feat/smaller":
"concat-stream@github:max-mapper/concat-stream#feat/smaller":
version "2.0.0"
resolved "https://codeload.github.com/maxogden/concat-stream/tar.gz/057bc7b5d6d8df26c8cf00a3f151b6721a0a8034"
resolved "https://codeload.github.com/max-mapper/concat-stream/tar.gz/057bc7b5d6d8df26c8cf00a3f151b6721a0a8034"
dependencies:
inherits "^2.0.3"
readable-stream "^3.0.2"
Expand Down Expand Up @@ -5550,7 +5550,7 @@ ipfs-http-client@34.0.0:
bs58 "^4.0.1"
buffer "^5.4.2"
cids "~0.7.1"
concat-stream "github:maxogden/concat-stream#feat/smaller"
concat-stream "github:max-mapper/concat-stream#feat/smaller"
debug "^4.1.0"
detect-node "^2.0.4"
end-of-stream "^1.4.1"
Expand Down Expand Up @@ -5579,7 +5579,7 @@ ipfs-http-client@34.0.0:
multibase "~0.6.0"
multicodec "~0.5.1"
multihashes "~0.4.14"
ndjson "github:maxogden/ndjson#feat/readable-stream3"
ndjson "github:max-mapper/ndjson#feat/readable-stream3"
once "^1.4.0"
peer-id "~0.12.3"
peer-info "~0.15.1"
Expand Down Expand Up @@ -7474,9 +7474,9 @@ napi-macros@~2.0.0:
resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b"
integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==

"ndjson@github:maxogden/ndjson#feat/readable-stream3":
"ndjson@github:max-mapper/ndjson#feat/readable-stream3":
version "1.5.0"
resolved "https://codeload.github.com/maxogden/ndjson/tar.gz/4db16da6b42e5b39bf300c3a7cde62abb3fa3a11"
resolved "https://codeload.github.com/max-mapper/ndjson/tar.gz/4db16da6b42e5b39bf300c3a7cde62abb3fa3a11"
dependencies:
json-stringify-safe "^5.0.1"
minimist "^1.2.0"
Expand Down
5 changes: 4 additions & 1 deletion desci-server/src/controllers/auth/magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const magic = async (req: Request, res: Response, next: NextFunction) =>

let user = await prismaClient.user.findFirst({
where: {
email,
email: {
equals: email,
mode: 'insensitive'
},
},
});

Expand Down
17 changes: 14 additions & 3 deletions desci-server/src/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ const sendMagicLinkEmail = async (email: string, ip?: string) => {

const expiresAt = new Date('1980-01-01');
await client.magicLink.updateMany({
where: { email },
where: {
email: {
equals: email,
mode: 'insensitive'
}
},
data: {
expiresAt,
},
Expand Down Expand Up @@ -195,7 +200,10 @@ const sendMagicLink = async (email: string, ip?: string) => {
// Check for recent magic link generation
const recentMagicLink = await client.magicLink.findFirst({
where: {
email,
email: {
equals: email,
mode: 'insensitive'
},
createdAt: {
gte: new Date(Date.now() - MAGIC_LINK_COOLDOWN),
},
Expand All @@ -208,7 +216,10 @@ const sendMagicLink = async (email: string, ip?: string) => {

const user = await client.user.findFirst({
where: {
email,
email: {
equals: email,
mode: 'insensitive'
},
},
});

Expand Down
2 changes: 1 addition & 1 deletion desci-server/src/services/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export const getDirectoryTreeCids = async (cid: string, externalCidMap: External
}
});
};
const flatCids = uniq(
const flatCids: string[] = uniq(
recurse(tree)
.filter(Boolean)
.map((e) => e.cid || e)
Expand Down
5 changes: 4 additions & 1 deletion desci-server/src/services/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ export async function getUserByOrcId(orcid: string): Promise<User | null> {

export async function getUserByEmail(email: string): Promise<User | null> {
logger.trace({ fn: 'getUserByEmail' }, `user::getUserByEmail ${hideEmail(email)}`);
const user = await client.user.findFirst({ where: { email } });
const user = await client.user.findFirst({ where: { email: {
equals: email,
mode: 'insensitive'
} } });

return user;
}
Expand Down

0 comments on commit 7d79aed

Please sign in to comment.