diff --git a/.env.example b/.env.example index 347b12cb..bb065b44 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ NX_AUTH0_CLIENT_SECRET= AUTH0_DEPLOY_CLIENT_SECRET= POSTMARK_SMTP_PASS= NX_SESSION_SECRET= +AUTH_SECRET= # If you want to test any code that utilizes the AWS SDK locally, add temporary STAGING credentials (can be retrieved from SSO dashboard) AWS_ACCESS_KEY_ID= diff --git a/apps/client/pages/api/auth/[...nextauth].ts b/apps/client/pages/api/auth/[...nextauth].ts index 91bdde6c..12a56c8f 100644 --- a/apps/client/pages/api/auth/[...nextauth].ts +++ b/apps/client/pages/api/auth/[...nextauth].ts @@ -24,7 +24,7 @@ export const authOptions = { }, session: { strategy: 'jwt' as SessionStrategy, - maxAge: 14 * 24 * 60 * 60, // 30 Days + maxAge: 7 * 24 * 60 * 60, // 7 Days }, providers: [ CredentialsProvider({ @@ -43,25 +43,19 @@ export const authOptions = { }) .safeParse(credentials) - console.log("here's the credentials", parsedCredentials) - if (parsedCredentials.success) { const { name, email, password } = parsedCredentials.data - console.log('Hitting endpoint to get user', email) const { data } = await axios.get(`/auth-users`, { params: { email: email }, headers: { 'Content-Type': 'application/json' }, }) + // TODO: use superjson to parse this more cleanly const user = data.data['json'] - console.log('here is the user', user) - if (!user) { - console.log('User does not exist, creating user') const hashedPassword = await bcrypt.hash(password, 10) - console.log('Hitting endpoint to create user', name, email, hashedPassword) const { data } = await axios.post('/auth-users', { name, email, diff --git a/apps/client/tailwind.config.js b/apps/client/tailwind.config.js index 948866a5..0fc8afa7 100644 --- a/apps/client/tailwind.config.js +++ b/apps/client/tailwind.config.js @@ -32,10 +32,6 @@ module.exports = merge(designSystemConfig, { wave: '3 wave 0.6s ease-in-out', float: 'float 4s infinite linear', }, - backgroundImage: { - 'login-background': - 'radial-gradient(100% 100% at clamp(20%, calc(30% + var(--mx) * 0.05), 40%) clamp(50%, calc(50% + var(--my) * 0.05), 60%), #4361EE33 0%, #16161Af4 120%)', - }, typography: () => { const { white, gray, cyan } = designSystemConfig.theme.colors return { diff --git a/libs/client/shared/src/api/useAuthUserApi.ts b/libs/client/shared/src/api/useAuthUserApi.ts index 5eb994c1..f6bae852 100644 --- a/libs/client/shared/src/api/useAuthUserApi.ts +++ b/libs/client/shared/src/api/useAuthUserApi.ts @@ -1,12 +1,7 @@ -import type { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query' import type { SharedType } from '@maybe-finance/shared' import type { AxiosInstance } from 'axios' -import Axios from 'axios' -import * as Sentry from '@sentry/react' import { useMemo } from 'react' -import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' -import { toast } from 'react-hot-toast' -import { DateTime } from 'luxon' +import { useQuery } from '@tanstack/react-query' import { useAxiosWithAuth } from '../hooks/useAxiosWithAuth' const AuthUserApi = (axios: AxiosInstance) => ({ @@ -14,37 +9,6 @@ const AuthUserApi = (axios: AxiosInstance) => ({ const { data } = await axios.get(`/auth-users/${email}`) return data }, - - async update(userData: SharedType.UpdateUser) { - const { data } = await axios.put('/users', userData) - return data - }, - - async get() { - const { data } = await axios.get('/users') - return data - }, - - async delete() { - return axios.delete('/users', { data: { confirm: true } }) - }, - - async updateOnboarding(input: { - flow: SharedType.OnboardingFlow - updates: { key: string; markedComplete: boolean }[] - markedComplete?: boolean - }) { - const { data } = await axios.put('/users/onboarding', input) - return data - }, - - async changePassword(newPassword: SharedType.PasswordReset) { - const { data } = await axios.put< - SharedType.PasswordReset, - SharedType.ApiResponse<{ success: boolean; error?: string }> - >('/users/change-password', newPassword) - return data - }, }) const staleTimes = { @@ -54,35 +18,13 @@ const staleTimes = { } export function useAuthUserApi() { - const queryClient = useQueryClient() const { axios } = useAxiosWithAuth() const api = useMemo(() => AuthUserApi(axios), [axios]) const useGetByEmail = (email: string) => useQuery(['auth-users', email], () => api.getByEmail(email), { staleTime: staleTimes.user }) - const useUpdateOnboarding = ( - options?: UseMutationOptions< - SharedType.User, - unknown, - { - flow: SharedType.OnboardingFlow - updates: { key: string; markedComplete: boolean }[] - markedComplete?: boolean - } - > - ) => - useMutation(api.updateOnboarding, { - onSettled: () => queryClient.invalidateQueries(['users', 'onboarding']), - ...options, - }) - - const useDelete = (options?: UseMutationOptions<{}, unknown, any>) => - useMutation(api.delete, options) - return { useGetByEmail, - useUpdateOnboarding, - useDelete, } }