Open source personal finance application
feat(auth): remove email sign-in, keep Google and Demo only
Ilya Komichevc18aff6a842f
diff --git a/app/app/composables/useSupabase.ts b/app/app/composables/useSupabase.tsindex 5a2999c8..0dd54fc6 100644--- a/app/app/composables/useSupabase.ts+++ b/app/app/composables/useSupabase.ts@@ -59,11 +59,7 @@ export function useSupabaseAuth() {// be allow-listed in Supabase auth config (config.toml additional_redirect_urls / dashboard).signInWithGoogle: (redirectTo: string) =>client.auth.signInWithOAuth({ options: { redirectTo }, provider: 'google' }),- signInWithPassword: (email: string, password: string) =>- client.auth.signInWithPassword({ email, password }),signOut: () => client.auth.signOut(),- signUp: (email: string, password: string) =>- client.auth.signUp({ email, password }),uid: computed<string | null>(() => session.value?.user?.id ?? null),user: computed(() => session.value?.user ?? null),}diff --git a/app/app/pages/login.vue b/app/app/pages/login.vueindex e8a635b8..ce79da3d 100644--- a/app/app/pages/login.vue+++ b/app/app/pages/login.vue@@ -5,7 +5,7 @@ import { useDemo } from '~/components/demo/useDemo'import { showErrorToast } from '~/composables/useStoreSync'import { useSupabaseAuth } from '~/composables/useSupabase'-const { session, signInWithGoogle, signInWithPassword, signUp } = useSupabaseAuth()+const { session, signInWithGoogle } = useSupabaseAuth()const logger = createLogger('login')definePageMeta({@@ -24,41 +24,11 @@ const route = useRoute()const router = useRouter()const isLoading = ref(false)-const isSignUp = ref(false)-const email = ref('')-const password = ref('')// Set right before redirecting to Google, read on return: marks this load as the OAuth callback.const OAUTH_PENDING_KEY = 'finapp.oauthPending'const isOauthReturn = ref(false)-async function submit() {- if (!email.value || !password.value)- return-- isDemo.value = null- isLoading.value = true-- try {- const { error } = isSignUp.value- ? await signUp(email.value, password.value)- : await signInWithPassword(email.value, password.value)-- if (error)- throw error-- // supabase-js has already persisted the session to localStorage by the time- // signIn/signUp resolves, so the synchronous route gate (hasPersistedSession)- // passes immediately - no need to mirror the uid anywhere before navigating.- router.push(getSafeRedirectPath(route.query.redirect))- }- catch (e: unknown) {- logger.error('auth error:', e)- showErrorToast('login.error')- isLoading.value = false- }-}-async function onGoogle() {isDemo.value = nullisLoading.value = true@@ -175,7 +145,7 @@ watch(session, (next) => {{{ t('login.description') }}</div>- <form class="grid min-w-[320px] items-center gap-3 py-14" @submit.prevent="submit">+ <div class="grid min-w-[320px] items-center gap-3 py-14"><UButtonblockcolor="neutral"@@ -191,47 +161,7 @@ watch(session, (next) => {<USeparator:label="t('login.or')"- class="!text-muted px-3 pb-3"- />-- <UInput- v-model="email"- autocomplete="email"- :placeholder="t('login.email')"- size="xl"- type="email"- />- <UInput- v-model="password"- :autocomplete="isSignUp ? 'new-password' : 'current-password'"- :placeholder="t('login.password')"- size="xl"- type="password"- />-- <UiButtonAccent- :loading="isLoading"- rounded- size="xl"- type="submit"- >- {{ isSignUp ? t('login.signUp') : t('login.signIn') }}- </UiButtonAccent>-- <UButton- block- color="neutral"- size="md"- type="button"- variant="ghost"- @click="isSignUp = !isSignUp"- >- {{ isSignUp ? t('login.haveAccount') : t('login.noAccount') }}- </UButton>-- <USeparator- :label="t('login.or')"- class="!text-muted px-3 pt-3"+ class="!text-muted px-3 py-3"/><UiButtonAccent@@ -243,7 +173,7 @@ watch(session, (next) => {>{{ t('login.openDemo') }}</UiButtonAccent>- </form>+ </div></div></div>diff --git a/app/i18n/locales/en-US.js b/app/i18n/locales/en-US.jsindex db7884d3..8702c255 100644--- a/app/i18n/locales/en-US.js+++ b/app/i18n/locales/en-US.js@@ -238,16 +238,10 @@ export default {login: {description: 'Powerful open-source finance application',- email: 'Email',error: 'Login failed. Please try again.',- haveAccount: 'Already have an account? Sign in',- noAccount: 'No account? Sign up',openDemo: 'Open Demo',or: 'or',- password: 'Password',- signIn: 'Sign in',signInWithGoogle: 'Sign in with Google',- signUp: 'Sign up',title: 'Login',},diff --git a/app/i18n/locales/ru-RU.js b/app/i18n/locales/ru-RU.jsindex 6eaf3863..17a4ec29 100644--- a/app/i18n/locales/ru-RU.js+++ b/app/i18n/locales/ru-RU.js@@ -238,16 +238,10 @@ export default {login: {description: 'Персональный финансовый ассистент',- email: 'Эл. почта',error: 'Ошибка входа. Попробуйте ещё раз.',- haveAccount: 'Уже есть аккаунт? Войти',- noAccount: 'Нет аккаунта? Зарегистрироваться',openDemo: 'Открыть демо',or: 'или',- password: 'Пароль',- signIn: 'Войти',signInWithGoogle: 'Войти через Google',- signUp: 'Регистрация',title: 'Вход',},diff --git a/app/supabase/config.toml b/app/supabase/config.tomlindex 0fc540d4..9db3b308 100644--- a/app/supabase/config.toml+++ b/app/supabase/config.toml@@ -214,7 +214,7 @@ web3 = 30[auth.email]# Allow/disallow new user signups via email to your project.-enable_signup = true+enable_signup = false# If enabled, a user will be required to confirm any email change on both the old, and new email# addresses. If disabled, only the new email is required to confirm.double_confirm_changes = true