Remove Google Auth and restore simple email/password login flow
This commit is contained in:
@ -2,7 +2,6 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
import { supabase } from '@/supabase'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
const emit = defineEmits(['toggle'])
|
const emit = defineEmits(['toggle'])
|
||||||
@ -46,47 +45,12 @@ const navigateByUserRole = (role: string) => {
|
|||||||
else router.push('/map')
|
else router.push('/map')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleGoogleLogin = async () => {
|
|
||||||
isLoading.value = true
|
|
||||||
errorMessage.value = ''
|
|
||||||
console.log('Iniciando Google Login...')
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { error } = await supabase.auth.signInWithOAuth({
|
|
||||||
provider: 'google',
|
|
||||||
options: {
|
|
||||||
redirectTo: window.location.origin
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (error) throw error
|
|
||||||
// Se redirige automáticamente
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('Error Google Login:', error)
|
|
||||||
errorMessage.value = `Error Google: ${error.message || t('common.error')}`
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
<!-- Google -->
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="google-btn"
|
|
||||||
:disabled="isLoading"
|
|
||||||
@click="handleGoogleLogin"
|
|
||||||
>
|
|
||||||
<img src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg" width="20" height="20" alt="Google" />
|
|
||||||
<span>{{ t('auth.googleLogin') }}</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="divider">
|
|
||||||
<span class="divider-line"></span>
|
|
||||||
<span class="divider-text">{{ t('auth.orEmail') }}</span>
|
|
||||||
<span class="divider-line"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Formulario -->
|
<!-- Formulario -->
|
||||||
<form @submit.prevent="handleLogin">
|
<form @submit.prevent="handleLogin">
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { supabase } from '@/supabase'
|
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
import { analyticsService } from '@/services/analyticsService'
|
import { analyticsService } from '@/services/analyticsService'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
@ -62,27 +61,7 @@ const navigateByUserRole = (role: string) => {
|
|||||||
else router.push('/map')
|
else router.push('/map')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleGoogleRegister = async () => {
|
|
||||||
isLoading.value = true
|
|
||||||
errorMessage.value = ''
|
|
||||||
console.log('Iniciando Google Register...')
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { error } = await supabase.auth.signInWithOAuth({
|
|
||||||
provider: 'google',
|
|
||||||
options: {
|
|
||||||
redirectTo: window.location.origin
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (error) throw error
|
|
||||||
// Redirect happens automatically
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('Error Google Register:', error)
|
|
||||||
errorMessage.value = `Error Google: ${error.message || t('common.error')}`
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -98,22 +77,7 @@ const handleGoogleRegister = async () => {
|
|||||||
<!-- Formulario -->
|
<!-- Formulario -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
||||||
<!-- Google -->
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="google-btn"
|
|
||||||
:disabled="isLoading"
|
|
||||||
@click="handleGoogleRegister"
|
|
||||||
>
|
|
||||||
<img src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg" width="20" height="20" alt="Google" />
|
|
||||||
<span>{{ t('auth.googleRegister') }}</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="divider">
|
|
||||||
<span class="divider-line"></span>
|
|
||||||
<span class="divider-text">{{ t('auth.orEmail') }}</span>
|
|
||||||
<span class="divider-line"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form @submit.prevent="handleRegister">
|
<form @submit.prevent="handleRegister">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user