Skip to content

Commit

Permalink
implement working autofill for TOTP 2FA codes for okta login screen (#…
Browse files Browse the repository at this point in the history
…482)

* implement working autofill for TOTP 2FA codes for okta login screen

* fix TSC

* fix TSC
  • Loading branch information
capaj committed Mar 24, 2024
1 parent c5a95ec commit 5c5b01e
Show file tree
Hide file tree
Showing 22 changed files with 2,229 additions and 1,646 deletions.
6 changes: 5 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ignorePaths": ["*/node_modules/**", "*/dist/**"],
"ignorePaths": [
"*/node_modules/**",
"*/dist/**"
],
"words": [
"APIKEY",
"appspot",
Expand Down Expand Up @@ -28,6 +31,7 @@
"Formik",
"GEOIP",
"graphiql",
"ICSS",
"IJWT",
"Ionicons",
"ITOTP",
Expand Down
26 changes: 13 additions & 13 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"@fastify/cookie": "9.3.1",
"@fastify/cors": "^9.0.1",
"@prisma/client": "^5.11.0",
"@react-native-firebase/app": "^19.0.1",
"@sentry/node": "^7.107.0",
"@react-native-firebase/app": "^19.1.0",
"@sentry/node": "^7.108.0",
"@types/jsonwebtoken": "^9.0.6",
"@upstash/redis": "^1.28.4",
"@upstash/redis": "^1.29.0",
"bytes": "^3.1.2",
"chalk": "^5.3.0",
"class-transformer": "^0.5.1",
Expand All @@ -34,23 +34,23 @@
"firebase-admin": "^12.0.0",
"graphql-fields": "^2.0.3",
"graphql-list-fields": "^2.0.4",
"graphql-scalars": "^1.22.5",
"graphql-scalars": "^1.23.0",
"ip": "^2.0.1",
"jsonwebtoken": "^9.0.2",
"lodash.set": "^4.3.2",
"mem": "^8",
"mercurius": "^13.4.0",
"mercurius": "^14.0.0",
"node-mailjet": "^6.0.5",
"pino": "^8.19.0",
"pino-pretty": "10.3.1",
"pino-pretty": "11.0.0",
"prisma": "^5.11.0",
"prisma-generator-checker": "^2.0.1",
"raw-body": "^2.5.2",
"reflect-metadata": "^0.2.1",
"source-map-support": "^0.5.21",
"stripe": "^14.21.0",
"stripe": "^14.22.0",
"type-graphql": "npm:@capaj/type-graphql@2.0.0-alpha.1",
"typescript": "^5.4.2",
"typescript": "^5.4.3",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand All @@ -64,21 +64,21 @@
"@types/lodash.set": "^4.3.9",
"@types/node-mailjet": "^3.3.12",
"@types/uuid": "^9.0.8",
"aws-cdk": "2.132.1",
"aws-cdk-lib": "^2.132.1",
"aws-cdk": "2.133.0",
"aws-cdk-lib": "^2.133.0",
"constructs": "^10.3.0",
"esbuild": "^0.20.2",
"graphql": "^16.8.1",
"is-ci": "^3.0.1",
"mz": "^2.7.0",
"nodemon": "^3.1.0",
"prisma-erd-generator": "^1.11.2",
"sql-formatter": "^15.2.0",
"sql-formatter": "^15.3.0",
"sql-highlight": "^4.4.2",
"ts-node": "^10.9.2",
"unplugin-swc": "^1.4.4",
"vite": "^5.1.6",
"vitest": "^1.3.1"
"vite": "^5.2.6",
"vitest": "^1.4.0"
},
"scripts": {
"dev": "DEBUG=au:* pnpm nodemon --exec ts-node-transpile-only server.ts",
Expand Down
20 changes: 20 additions & 0 deletions backend/schemas/RootResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ export class RootResolver {
@Ctx() ctx: IContextAuthenticated
) {
if (hosts) {
// TODO only return new web inputs created after last sync
return ctx.prisma.webInput.findMany({
where: {
host: {
Expand Down Expand Up @@ -489,6 +490,25 @@ export class RootResolver {
addedByUserId: ctx.jwtPayload.userId
}

const existing = await ctx.prisma.webInput.findFirst({
where: {
url: forUpsert.url,
kind: forUpsert.kind
},
select: {
id: true
}
})

if (existing) {
// it can happen that website changes the input field, so we delete the old one and add the new one
await ctx.prisma.webInput.delete({
where: {
id: existing.id
}
})
}

try {
// prisma is weird because it is throwing unique constraint conflict errors here. upsert should never throw that.
const input = await ctx.prisma.webInput.upsert({
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"Notifications"
],
"dependencies": {
"@apollo/client": "^3.9.7",
"@apollo/client": "^3.9.9",
"@babel/preset-env": "^7.23.7",
"@babel/preset-react": "^7.23.3",
"@hookform/resolvers": "^2.9.11",
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@apollo/client": "^3.9.7",
"@apollo/client": "^3.9.9",
"@chakra-ui/react": "2.8.2",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
Expand All @@ -27,27 +27,29 @@
"@graphql-codegen/typescript-operations": "^4.2.0",
"@graphql-codegen/typescript-react-apollo": "^4.3.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.27",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react": "^7.34.1",
"framer-motion": "^11",
"generate-password": "^1.7.1",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"typescript": "^5.4.2",
"typescript": "^5.4.3",
"vite-tsconfig-paths": "^4.3.2",
"zod": "^3.22.4",
"zx": "^7.2.3"
},
"scripts": {
"devBE": "cd backend && pnpm run dev",
"devEX": "cd web-extension && pnpm run dev",
"dev:be": "cd backend && pnpm run dev",
"dev:ex": "cd web-extension && pnpm run dev",
"dev": "concurrently \"pnpm dev:be\" \"pnpm dev:ex\"",
"tsc": "cd backend && tsc && cd .. && cd web-extension && tsc && cd .. && cd mobile-app && tsc",
"bumpDeps": "ncu -u && cd backend && ncu -u && cd .. && cd web-extension && ncu -u",
"test": "cd backend && pnpm test && cd .. && cd web-extension && pnpm test",
Expand Down

0 comments on commit 5c5b01e

Please sign in to comment.