Critical Fix: Complete rewrite of Auth components to restore visibility, and fix Map user location persistence
This commit is contained in:
@ -6,6 +6,8 @@ import { useI18n } from 'vue-i18n'
|
||||
|
||||
const emit = defineEmits(['toggle'])
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
@ -13,193 +15,132 @@ const keepSession = ref(false)
|
||||
const isLoading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
const showPassword = ref(false)
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (!email.value || !password.value) return
|
||||
|
||||
isLoading.value = true
|
||||
errorMessage.value = ''
|
||||
|
||||
try {
|
||||
await authStore.login(email.value.trim().toLowerCase(), password.value, keepSession.value)
|
||||
// El rol ya está disponible en el store (del JWT), navegar directo
|
||||
navigateByUserRole(authStore.role || 'PASSENGER')
|
||||
|
||||
// Al iniciar sesión, el store ya tiene el rol. Redirigir según corresponda.
|
||||
const role = (authStore.role || 'PASSENGER').toUpperCase()
|
||||
if (role === 'ADMIN') router.push('/admin')
|
||||
else if (role === 'DRIVER') router.push('/driver')
|
||||
else if (role === 'PROMOTER') router.push('/promoter')
|
||||
else router.push('/map')
|
||||
|
||||
} catch (error: any) {
|
||||
console.error('Error Login:', error)
|
||||
console.error('SIBU | Error Login:', error)
|
||||
if (error.message?.includes('Invalid login credentials')) {
|
||||
errorMessage.value = t('auth.invalidCreds')
|
||||
} else {
|
||||
errorMessage.value = `${t('common.error')}: ${error.message || t('common.noData')}`
|
||||
errorMessage.value = error.message || t('common.error')
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const navigateByUserRole = (role: string) => {
|
||||
const r = role.toUpperCase()
|
||||
if (r === 'ADMIN') router.push('/admin')
|
||||
else if (r === 'DRIVER') router.push('/driver')
|
||||
else if (r === 'PROMOTER') router.push('/promoter')
|
||||
else router.push('/map')
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="login-form" style="border: 2px solid rgba(254, 231, 21, 0.3); border-radius: 12px; margin: 10px;">
|
||||
<!-- Indicador de carga para diagnóstico -->
|
||||
<div style="font-size: 10px; color: var(--active-color); opacity: 0.5; text-align: center;">[LoginForm Mounted]</div>
|
||||
|
||||
|
||||
<!-- Formulario -->
|
||||
<form @submit.prevent="handleLogin">
|
||||
<div class="login-form">
|
||||
<form @submit.prevent="handleLogin" class="form-container">
|
||||
<!-- Email -->
|
||||
<div class="field">
|
||||
<label class="field-label" for="login-email">{{ t('auth.emailLabel') }}</label>
|
||||
<label class="field-label">{{ t('auth.emailLabel') }}</label>
|
||||
<div class="input-wrap">
|
||||
<span class="material-icons input-icon">alternate_email</span>
|
||||
<input
|
||||
id="login-email"
|
||||
type="email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
:placeholder="t('auth.emailPlaceholder')"
|
||||
required
|
||||
autocomplete="email"
|
||||
class="field-input"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contraseña -->
|
||||
<!-- Password -->
|
||||
<div class="field">
|
||||
<label class="field-label" for="login-password">{{ t('auth.passLabel') }}</label>
|
||||
<label class="field-label">{{ t('auth.passLabel') }}</label>
|
||||
<div class="input-wrap">
|
||||
<span class="material-icons input-icon">lock</span>
|
||||
<input
|
||||
id="login-password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
v-model="password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
placeholder="••••••••"
|
||||
required
|
||||
autocomplete="current-password"
|
||||
class="field-input"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="toggle-pw"
|
||||
@click="showPassword = !showPassword"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mantener sesión -->
|
||||
<label class="keep-session">
|
||||
<input type="checkbox" v-model="keepSession" class="keep-checkbox" />
|
||||
<span class="keep-box" :class="{ 'keep-box--on': keepSession }">
|
||||
<span v-if="keepSession" class="material-icons keep-check">check</span>
|
||||
</span>
|
||||
<span class="keep-label">{{ t('auth.keepSession') }}</span>
|
||||
<!-- Keep Session -->
|
||||
<div class="options-row">
|
||||
<label class="checkbox-container">
|
||||
<input type="checkbox" v-model="keepSession" />
|
||||
<span class="checkmark"></span>
|
||||
<span class="checkbox-label">{{ t('auth.keepSession') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Error -->
|
||||
<p v-if="errorMessage" class="error-msg">
|
||||
<span class="material-icons error-icon">error_outline</span>
|
||||
<!-- Error Message -->
|
||||
<transition name="shake">
|
||||
<div v-if="errorMessage" class="error-box">
|
||||
<span class="material-icons">error_outline</span>
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<!-- Botón enviar -->
|
||||
<!-- Submit Button -->
|
||||
<button type="submit" class="submit-btn" :disabled="isLoading">
|
||||
<span v-if="isLoading" class="btn-spinner"></span>
|
||||
<span>{{ isLoading ? t('auth.loggingIn') : t('auth.loginTab') }}</span>
|
||||
<span v-if="isLoading" class="loader"></span>
|
||||
<span v-else>{{ t('auth.loginTab') }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Switch a registro -->
|
||||
<p class="switch-text">
|
||||
<!-- Switch -->
|
||||
<p class="switch-p">
|
||||
{{ t('auth.noAccount') }}
|
||||
<button type="button" class="switch-link" @click="emit('toggle')">{{ t('auth.registerHere') }}</button>
|
||||
<button type="button" @click="emit('toggle')" class="switch-btn">
|
||||
{{ t('auth.registerHere') }}
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.login-form {
|
||||
padding: 1.5rem;
|
||||
padding: 1.5rem 2rem 2rem;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
/* ─── Google ─── */
|
||||
.google-btn {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.875rem;
|
||||
background: var(--bg-primary);
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s, background 0.2s;
|
||||
}
|
||||
|
||||
.google-btn:hover:not(:disabled) {
|
||||
border-color: var(--active-color);
|
||||
}
|
||||
|
||||
.google-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* ─── Divider ─── */
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--border-color);
|
||||
}
|
||||
|
||||
.divider-text {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ─── Campos ─── */
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.field + .field {
|
||||
margin-top: 0.875rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-secondary);
|
||||
padding-left: 0.25rem;
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
|
||||
.input-wrap {
|
||||
@ -210,175 +151,161 @@ const navigateByUserRole = (role: string) => {
|
||||
|
||||
.input-icon {
|
||||
position: absolute;
|
||||
left: 0.875rem;
|
||||
font-size: 1.125rem;
|
||||
left: 1rem;
|
||||
font-size: 1.1rem;
|
||||
color: var(--text-secondary);
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.field-input {
|
||||
width: 100%;
|
||||
padding: 0.875rem 0.875rem 0.875rem 2.75rem;
|
||||
padding: 0.875rem 1rem 0.875rem 2.75rem;
|
||||
background: var(--bg-primary);
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.875rem;
|
||||
border-radius: 1rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.field-input::placeholder {
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.5;
|
||||
font-size: 0.95rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.field-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--active-color);
|
||||
box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1);
|
||||
}
|
||||
|
||||
.toggle-pw {
|
||||
position: absolute;
|
||||
right: 0.875rem;
|
||||
right: 1rem;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.toggle-pw .material-icons {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
/* ─── Mantener sesión ─── */
|
||||
.keep-session {
|
||||
/* Checkbox Estilizado */
|
||||
.checkbox-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
gap: 0.75rem;
|
||||
cursor: pointer;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.keep-checkbox {
|
||||
.checkbox-container input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.keep-box {
|
||||
width: 1.125rem;
|
||||
height: 1.125rem;
|
||||
.checkmark {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.375rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
border-radius: 6px;
|
||||
position: relative;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.keep-box--on {
|
||||
.checkbox-container input:checked + .checkmark {
|
||||
background: var(--active-color);
|
||||
border-color: var(--active-color);
|
||||
}
|
||||
|
||||
.keep-check {
|
||||
font-size: 0.875rem;
|
||||
.checkmark:after {
|
||||
content: "check";
|
||||
font-family: 'Material Icons';
|
||||
position: absolute;
|
||||
font-size: 0.9rem;
|
||||
color: #101820;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.keep-label {
|
||||
font-size: 0.8125rem;
|
||||
.checkbox-container input:checked + .checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ─── Error ─── */
|
||||
.error-msg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border: 1px solid rgba(239, 68, 68, 0.2);
|
||||
border-radius: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
color: #ef4444;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
font-size: 1.125rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ─── Botón enviar ─── */
|
||||
/* Botones */
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem;
|
||||
background: var(--active-color);
|
||||
color: #101820;
|
||||
border: none;
|
||||
border-radius: 0.875rem;
|
||||
font-size: 0.9375rem;
|
||||
border-radius: 1rem;
|
||||
font-weight: 800;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s, transform 0.15s;
|
||||
margin-top: 1rem;
|
||||
margin-top: 0.5rem;
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.7;
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.submit-btn:not(:disabled):active {
|
||||
transform: scale(0.98);
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(254, 231, 21, 0.3);
|
||||
}
|
||||
|
||||
.btn-spinner {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border: 2px solid rgba(16, 24, 32, 0.3);
|
||||
border-top-color: #101820;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* ─── Switch ─── */
|
||||
.switch-text {
|
||||
text-align: center;
|
||||
font-size: 0.8125rem;
|
||||
.error-box {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: #ef4444;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.switch-link {
|
||||
.switch-p {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.switch-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--active-color);
|
||||
font-size: inherit;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
margin-left: 0.25rem;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
|
||||
.loader {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
border: 2px solid rgba(16, 24, 32, 0.3);
|
||||
border-top-color: #101820;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.shake-enter-active {
|
||||
animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
10%, 90% { transform: translate3d(-1px, 0, 0); }
|
||||
20%, 80% { transform: translate3d(2px, 0, 0); }
|
||||
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
|
||||
40%, 60% { transform: translate3d(4px, 0, 0); }
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -2,12 +2,10 @@
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const emit = defineEmits(['toggle', 'success'])
|
||||
const { t } = useI18n()
|
||||
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
@ -17,84 +15,69 @@ const password = ref('')
|
||||
const autoLocation = ref(false)
|
||||
const isLoading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
const successMessage = ref('')
|
||||
const showPassword = ref(false)
|
||||
const isSuccess = ref(false)
|
||||
|
||||
const handleRegister = async () => {
|
||||
if (!email.value || !password.value || !fullName.value) return
|
||||
|
||||
isLoading.value = true
|
||||
errorMessage.value = ''
|
||||
|
||||
try {
|
||||
const cleanEmail = email.value.trim().toLowerCase()
|
||||
const cleanPass = password.value
|
||||
await authStore.register(
|
||||
email.value.trim().toLowerCase(),
|
||||
password.value,
|
||||
fullName.value.trim(),
|
||||
autoLocation.value
|
||||
)
|
||||
|
||||
await authStore.register(cleanEmail, cleanPass, fullName.value.trim(), autoLocation.value)
|
||||
|
||||
analyticsService.logEvent({
|
||||
event_name: 'sign_up',
|
||||
properties: { method: 'email' }
|
||||
})
|
||||
|
||||
successMessage.value = t('auth.successTitle')
|
||||
|
||||
// Delay navigation so user can see the success card
|
||||
isSuccess.value = true
|
||||
setTimeout(() => {
|
||||
navigateByUserRole(authStore.role || 'PASSENGER')
|
||||
}, 1500)
|
||||
// Redirigir según el rol asignado (usualmente PASSENGER)
|
||||
const role = (authStore.role || 'PASSENGER').toUpperCase()
|
||||
if (role === 'ADMIN') router.push('/admin')
|
||||
else if (role === 'DRIVER') router.push('/driver')
|
||||
else if (role === 'PROMOTER') router.push('/promoter')
|
||||
else router.push('/map')
|
||||
}, 2000)
|
||||
|
||||
} catch (error: any) {
|
||||
console.error('Error detallado de registro:', error)
|
||||
if (error.message?.includes('User already registered') || error.message?.includes('already exists')) {
|
||||
console.error('SIBU | Error Register:', error)
|
||||
if (error.message?.includes('already registered')) {
|
||||
errorMessage.value = t('auth.emailRegistered')
|
||||
} else {
|
||||
errorMessage.value = `${t('common.error')}: ${error.message || t('common.noData')}`
|
||||
errorMessage.value = error.message || t('common.error')
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
const navigateByUserRole = (role: string) => {
|
||||
const r = role.toUpperCase()
|
||||
if (r === 'ADMIN') router.push('/admin')
|
||||
else if (r === 'DRIVER') router.push('/driver')
|
||||
else if (r === 'PROMOTER') router.push('/promoter')
|
||||
else router.push('/map')
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="register-form" style="border: 2px solid rgba(59, 130, 246, 0.3); border-radius: 12px; margin: 10px;">
|
||||
<!-- Indicador de carga para diagnóstico -->
|
||||
<div style="font-size: 10px; color: #3b82f6; opacity: 0.5; text-align: center;">[RegisterForm Mounted]</div>
|
||||
|
||||
<div class="register-form">
|
||||
<!-- Éxito -->
|
||||
<div v-if="successMessage" class="success-card">
|
||||
<span class="material-icons success-icon">check_circle</span>
|
||||
<h3 class="success-title">{{ t('auth.successTitle') }}</h3>
|
||||
<p class="success-desc">{{ successMessage }}</p>
|
||||
<div v-if="isSuccess" class="success-view">
|
||||
<div class="success-icon-wrap">
|
||||
<span class="material-icons">check_circle</span>
|
||||
</div>
|
||||
<h3>{{ t('auth.successTitle') }}</h3>
|
||||
<p>{{ t('common.loading') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Formulario -->
|
||||
<template v-else>
|
||||
|
||||
|
||||
|
||||
<form @submit.prevent="handleRegister">
|
||||
|
||||
<!-- Nombre -->
|
||||
<form v-else @submit.prevent="handleRegister" class="form-container">
|
||||
<!-- Full Name -->
|
||||
<div class="field">
|
||||
<label class="field-label" for="reg-name">{{ t('auth.fullNameLabel') }}</label>
|
||||
<label class="field-label">{{ t('auth.fullNameLabel') }}</label>
|
||||
<div class="input-wrap">
|
||||
<span class="material-icons input-icon">person</span>
|
||||
<input
|
||||
id="reg-name"
|
||||
type="text"
|
||||
v-model="fullName"
|
||||
type="text"
|
||||
:placeholder="t('auth.fullNamePlaceholder')"
|
||||
required
|
||||
autocomplete="name"
|
||||
class="field-input"
|
||||
/>
|
||||
</div>
|
||||
@ -102,183 +85,128 @@ const navigateByUserRole = (role: string) => {
|
||||
|
||||
<!-- Email -->
|
||||
<div class="field">
|
||||
<label class="field-label" for="reg-email">{{ t('auth.emailLabel') }}</label>
|
||||
<label class="field-label">{{ t('auth.emailLabel') }}</label>
|
||||
<div class="input-wrap">
|
||||
<span class="material-icons input-icon">alternate_email</span>
|
||||
<input
|
||||
id="reg-email"
|
||||
type="email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
:placeholder="t('auth.emailPlaceholder')"
|
||||
required
|
||||
autocomplete="email"
|
||||
class="field-input"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contraseña -->
|
||||
<!-- Password -->
|
||||
<div class="field">
|
||||
<label class="field-label" for="reg-password">{{ t('auth.passLabel') }}</label>
|
||||
<label class="field-label">{{ t('auth.passLabel') }}</label>
|
||||
<div class="input-wrap">
|
||||
<span class="material-icons input-icon">lock</span>
|
||||
<input
|
||||
id="reg-password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
v-model="password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
:placeholder="t('auth.passMin8')"
|
||||
required
|
||||
minlength="8"
|
||||
autocomplete="new-password"
|
||||
class="field-input"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="toggle-pw"
|
||||
@click="showPassword = !showPassword"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ubicación Inteligente -->
|
||||
<label class="keep-session">
|
||||
<input type="checkbox" v-model="autoLocation" class="keep-checkbox" />
|
||||
<span class="keep-box" :class="{ 'keep-box--on': autoLocation }">
|
||||
<span v-if="autoLocation" class="material-icons keep-check">check</span>
|
||||
</span>
|
||||
<span class="keep-label">{{ t('auth.smartLocation') }}</span>
|
||||
<!-- Smart Location -->
|
||||
<div class="options-row">
|
||||
<label class="checkbox-container">
|
||||
<input type="checkbox" v-model="autoLocation" />
|
||||
<span class="checkmark"></span>
|
||||
<span class="checkbox-label">{{ t('auth.smartLocation') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Error -->
|
||||
<p v-if="errorMessage" class="error-msg">
|
||||
<span class="material-icons error-icon">error_outline</span>
|
||||
<!-- Error Message -->
|
||||
<transition name="shake">
|
||||
<div v-if="errorMessage" class="error-box">
|
||||
<span class="material-icons">error_outline</span>
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<!-- Botón enviar -->
|
||||
<!-- Submit Button -->
|
||||
<button type="submit" class="submit-btn" :disabled="isLoading">
|
||||
<span v-if="isLoading" class="btn-spinner"></span>
|
||||
<span>{{ isLoading ? t('auth.creatingAccount') : t('auth.registerTab') }}</span>
|
||||
<span v-if="isLoading" class="loader"></span>
|
||||
<span v-else>{{ t('auth.registerTab') }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Switch a login -->
|
||||
<p class="switch-text">
|
||||
<!-- Switch -->
|
||||
<p class="switch-p">
|
||||
{{ t('auth.hasAccount') }}
|
||||
<button type="button" class="switch-link" @click="emit('toggle')">{{ t('auth.loginHere') }}</button>
|
||||
<button type="button" @click="emit('toggle')" class="switch-btn">
|
||||
{{ t('auth.loginHere') }}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
</template>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.register-form {
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 1.5rem 2rem 2rem;
|
||||
}
|
||||
|
||||
/* ─── Google ─── */
|
||||
.google-btn {
|
||||
width: 100%;
|
||||
.success-view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 2rem 0;
|
||||
text-align: center;
|
||||
animation: zoomIn 0.4s ease-out;
|
||||
}
|
||||
|
||||
@keyframes zoomIn {
|
||||
from { opacity: 0; transform: scale(0.9); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
|
||||
.success-icon-wrap {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: rgba(74, 222, 128, 0.1);
|
||||
color: #4ade80;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.875rem;
|
||||
background: var(--bg-primary);
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s, background 0.2s;
|
||||
}
|
||||
|
||||
.google-btn:hover:not(:disabled) {
|
||||
border-color: var(--active-color);
|
||||
.success-icon-wrap .material-icons {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
|
||||
.google-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* ─── Divider ─── */
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--border-color);
|
||||
}
|
||||
|
||||
.divider-text {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ─── Éxito ─── */
|
||||
.success-card {
|
||||
background: rgba(74, 222, 128, 0.08);
|
||||
border: 1px solid rgba(74, 222, 128, 0.2);
|
||||
border-radius: 1rem;
|
||||
padding: 2rem 1.5rem;
|
||||
text-align: center;
|
||||
.form-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
gap: 1.1rem;
|
||||
}
|
||||
|
||||
.success-icon {
|
||||
font-size: 3rem;
|
||||
color: #4ade80;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.success-title {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 800;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.success-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ─── Campos ─── */
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.field + .field {
|
||||
margin-top: 0.875rem;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-secondary);
|
||||
padding-left: 0.25rem;
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
|
||||
.input-wrap {
|
||||
@ -289,175 +217,162 @@ const navigateByUserRole = (role: string) => {
|
||||
|
||||
.input-icon {
|
||||
position: absolute;
|
||||
left: 0.875rem;
|
||||
font-size: 1.125rem;
|
||||
left: 1rem;
|
||||
font-size: 1.1rem;
|
||||
color: var(--text-secondary);
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.field-input {
|
||||
width: 100%;
|
||||
padding: 0.875rem 0.875rem 0.875rem 2.75rem;
|
||||
padding: 0.8rem 1rem 0.8rem 2.75rem;
|
||||
background: var(--bg-primary);
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.875rem;
|
||||
border-radius: 1rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.field-input::placeholder {
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.5;
|
||||
font-size: 0.95rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.field-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--active-color);
|
||||
box-shadow: 0 0 0 4px rgba(254, 231, 21, 0.1);
|
||||
}
|
||||
|
||||
.toggle-pw {
|
||||
position: absolute;
|
||||
right: 0.875rem;
|
||||
right: 1rem;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.toggle-pw .material-icons {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
/* ─── Error ─── */
|
||||
.error-msg {
|
||||
/* Checkbox Estilizado */
|
||||
.checkbox-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border: 1px solid rgba(239, 68, 68, 0.2);
|
||||
border-radius: 0.75rem;
|
||||
padding: 0.75rem 1rem;
|
||||
color: #ef4444;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
font-size: 1.125rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ─── Botón ─── */
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem;
|
||||
background: var(--active-color);
|
||||
color: #101820;
|
||||
border: none;
|
||||
border-radius: 0.875rem;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 800;
|
||||
font-family: inherit;
|
||||
gap: 0.75rem;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s, transform 0.15s;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.7;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.submit-btn:not(:disabled):active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.btn-spinner {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border: 2px solid rgba(16, 24, 32, 0.3);
|
||||
border-top-color: #101820;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.7s linear infinite;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* ─── Switch ─── */
|
||||
.switch-text {
|
||||
text-align: center;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.switch-link {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--active-color);
|
||||
font-size: inherit;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
margin-left: 0.25rem;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Mantener sesión (reutilizado para Smart Location) */
|
||||
.keep-session {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
cursor: pointer;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.keep-checkbox {
|
||||
.checkbox-container input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.keep-box {
|
||||
width: 1.125rem;
|
||||
height: 1.125rem;
|
||||
.checkmark {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
border: 1.5px solid var(--border-color);
|
||||
border-radius: 0.375rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
border-radius: 6px;
|
||||
position: relative;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.keep-box--on {
|
||||
.checkbox-container input:checked + .checkmark {
|
||||
background: var(--active-color);
|
||||
border-color: var(--active-color);
|
||||
}
|
||||
|
||||
.keep-check {
|
||||
font-size: 0.875rem;
|
||||
.checkmark:after {
|
||||
content: "check";
|
||||
font-family: 'Material Icons';
|
||||
position: absolute;
|
||||
font-size: 0.9rem;
|
||||
color: #101820;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.keep-label {
|
||||
font-size: 0.8125rem;
|
||||
.checkbox-container input:checked + .checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/* Botones */
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
background: var(--active-color);
|
||||
color: #101820;
|
||||
border: none;
|
||||
border-radius: 1rem;
|
||||
font-weight: 800;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
margin-top: 0.5rem;
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(254, 231, 21, 0.3);
|
||||
}
|
||||
|
||||
.error-box {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: #ef4444;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.switch-p {
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.switch-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--active-color);
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
margin-left: 0.25rem;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.loader {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
border: 2px solid rgba(16, 24, 32, 0.3);
|
||||
border-top-color: #101820;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.shake-enter-active {
|
||||
animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
10%, 90% { transform: translate3d(-1px, 0, 0); }
|
||||
20%, 80% { transform: translate3d(2px, 0, 0); }
|
||||
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
|
||||
40%, 60% { transform: translate3d(4px, 0, 0); }
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,84 +1,76 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import LoginForm from '@/components/auth/LoginForm.vue'
|
||||
import RegisterForm from '@/components/auth/RegisterForm.vue'
|
||||
import LoginForm from '../components/auth/LoginForm.vue'
|
||||
import RegisterForm from '../components/auth/RegisterForm.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
const isLogin = ref(true)
|
||||
const toggleAuth = () => { isLogin.value = !isLogin.value }
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const sessionExpiredMessage = ref('')
|
||||
const isLogin = ref(true)
|
||||
|
||||
// Detectar si fue redirigido por sesión expirada
|
||||
onMounted(() => {
|
||||
if (route.query.reason === 'session_expired') {
|
||||
sessionExpiredMessage.value = t('auth.sessionExpired')
|
||||
}
|
||||
})
|
||||
const toggleAuth = () => {
|
||||
isLogin.value = !isLogin.value
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="auth-page">
|
||||
<!-- Fondo con glow SIBU -->
|
||||
<div class="auth-glow" aria-hidden="true"></div>
|
||||
|
||||
<div class="auth-wrapper">
|
||||
<!-- Botón volver al mapa -->
|
||||
<button class="back-to-map" @click="router.push('/map')">
|
||||
<span class="material-icons">arrow_back</span>
|
||||
{{ t('auth.back') }}
|
||||
</button>
|
||||
|
||||
<!-- Branding -->
|
||||
<div class="auth-brand">
|
||||
<h1 class="brand-title">SIBU</h1>
|
||||
<p class="brand-subtitle">{{ t('auth.brandingSubtitle') }}</p>
|
||||
<!-- Fondo Decorativo -->
|
||||
<div class="bg-decoration">
|
||||
<div class="circle circle-1"></div>
|
||||
<div class="circle circle-2"></div>
|
||||
</div>
|
||||
|
||||
<!-- Card principal -->
|
||||
<!-- Contenido Principal -->
|
||||
<div class="auth-container">
|
||||
<!-- Botón Volver -->
|
||||
<button @click="router.push('/')" class="back-btn">
|
||||
<span class="material-icons">arrow_back</span>
|
||||
<span>{{ t('auth.back') }}</span>
|
||||
</button>
|
||||
|
||||
<div class="auth-card">
|
||||
<!-- Tabs Login / Registro -->
|
||||
<div class="auth-tabs">
|
||||
<!-- Header con Logo -->
|
||||
<header class="auth-header">
|
||||
<img src="@/assets/logo.png" alt="SIBU Logo" class="auth-logo" />
|
||||
<p class="auth-subtitle">{{ t('auth.brandingSubtitle') }}</p>
|
||||
</header>
|
||||
|
||||
<!-- Selector de Pestañas -->
|
||||
<nav class="auth-tabs">
|
||||
<button
|
||||
class="auth-tab"
|
||||
:class="{ 'auth-tab--active': isLogin }"
|
||||
class="tab-btn"
|
||||
:class="{ active: isLogin }"
|
||||
@click="isLogin = true"
|
||||
>
|
||||
{{ t('auth.loginTab') }}
|
||||
</button>
|
||||
<button
|
||||
class="auth-tab"
|
||||
:class="{ 'auth-tab--active': !isLogin }"
|
||||
class="tab-btn"
|
||||
:class="{ active: !isLogin }"
|
||||
@click="isLogin = false"
|
||||
>
|
||||
{{ t('auth.registerTab') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="tab-indicator" :class="{ 'on-right': !isLogin }"></div>
|
||||
</nav>
|
||||
|
||||
<!-- Alerta de sesión expirada -->
|
||||
<div v-if="sessionExpiredMessage" class="redirect-error" style="background: rgba(234, 179, 8, 0.1); border-color: rgba(234, 179, 8, 0.2); color: #eab308;">
|
||||
<span class="material-icons">lock_clock</span>
|
||||
{{ sessionExpiredMessage }}
|
||||
</div>
|
||||
|
||||
<!-- Contenedor de formularios con diagnóstico forzado -->
|
||||
<div class="auth-forms-content" style="min-height: 350px; display: flex; flex-direction: column; border: 1px dashed rgba(255,255,255,0.1); padding: 5px;">
|
||||
<!-- Texto de diagnóstico (visible solo si los componentes fallan) -->
|
||||
<div v-if="isLogin" style="display: block !important; visibility: visible !important; opacity: 1 !important; width: 100%;">
|
||||
<!-- Contenido de Formularios -->
|
||||
<div class="auth-body">
|
||||
<div v-if="isLogin" class="form-wrapper">
|
||||
<LoginForm @toggle="toggleAuth" />
|
||||
</div>
|
||||
<div v-else style="display: block !important; visibility: visible !important; opacity: 1 !important; width: 100%;">
|
||||
<div v-else class="form-wrapper">
|
||||
<RegisterForm @toggle="toggleAuth" @success="isLogin = true" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<p class="auth-footer">{{ t('auth.footer') }}</p>
|
||||
<footer class="auth-footer">
|
||||
<p>{{ t('auth.footer') }}</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -90,167 +82,166 @@ onMounted(() => {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--bg-primary);
|
||||
padding: 1.5rem;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
font-family: var(--font-family);
|
||||
}
|
||||
|
||||
/* Glow decorativo SIBU amarillo */
|
||||
.auth-glow {
|
||||
.bg-decoration {
|
||||
position: absolute;
|
||||
top: -20%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle, rgba(254, 231, 21, 0.08) 0%, transparent 70%);
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.auth-wrapper {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
.circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(80px);
|
||||
opacity: 0.15;
|
||||
}
|
||||
|
||||
.circle-1 {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
background: var(--active-color);
|
||||
top: -100px;
|
||||
right: -100px;
|
||||
}
|
||||
|
||||
.circle-2 {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
background: #3b82f6;
|
||||
bottom: -50px;
|
||||
left: -50px;
|
||||
}
|
||||
|
||||
.auth-container {
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.75rem;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* ─── Branding ─── */
|
||||
.auth-brand {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 900;
|
||||
letter-spacing: -0.05em;
|
||||
color: var(--active-color);
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.brand-subtitle {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
margin: 0.375rem 0 0;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
/* ─── Card ─── */
|
||||
.auth-card {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 1.5rem;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
/* ─── Tabs ─── */
|
||||
.auth-tabs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.auth-tab {
|
||||
padding: 1rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
.auth-tab:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.auth-tab--active {
|
||||
color: var(--active-color);
|
||||
border-bottom-color: var(--active-color);
|
||||
}
|
||||
|
||||
/* ─── Errores de Redirección ─── */
|
||||
.redirect-error {
|
||||
margin: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border: 1px solid rgba(239, 68, 68, 0.2);
|
||||
border-radius: 0.75rem;
|
||||
color: #ef4444;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 0.5rem;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.redirect-error .material-icons {
|
||||
font-size: 1.125rem;
|
||||
.back-btn:hover {
|
||||
color: var(--text-primary);
|
||||
background: rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
/* ─── Transición entre formularios ─── */
|
||||
.auth-slide-enter-active,
|
||||
.auth-slide-leave-active {
|
||||
transition: opacity 0.22s ease, transform 0.22s ease;
|
||||
}
|
||||
|
||||
.auth-slide-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateX(16px);
|
||||
}
|
||||
|
||||
.auth-slide-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(-16px);
|
||||
}
|
||||
|
||||
/* ─── Botón volver ─── */
|
||||
.back-to-map {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
.auth-card {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
color: var(--text-secondary);
|
||||
border-radius: 2rem;
|
||||
box-shadow: 0 20px 50px rgba(0,0,0,0.2);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.auth-header {
|
||||
padding: 2rem 2rem 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.auth-logo {
|
||||
height: 60px;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.auth-subtitle {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
padding: 10px 16px;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.back-to-map:hover {
|
||||
color: var(--active-color);
|
||||
border-color: var(--active-color);
|
||||
background: rgba(254, 231, 21, 0.06);
|
||||
}
|
||||
|
||||
.back-to-map .material-icons {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
/* ─── Footer ─── */
|
||||
.auth-footer {
|
||||
text-align: center;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.5;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.auth-tabs {
|
||||
position: relative;
|
||||
display: flex;
|
||||
margin: 0 1.5rem;
|
||||
background: var(--bg-primary);
|
||||
padding: 0.35rem;
|
||||
border-radius: 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.tab-btn {
|
||||
flex: 1;
|
||||
padding: 0.75rem;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
.tab-btn.active {
|
||||
color: #101820;
|
||||
}
|
||||
|
||||
.tab-indicator {
|
||||
position: absolute;
|
||||
top: 0.35rem;
|
||||
bottom: 0.35rem;
|
||||
left: 0.35rem;
|
||||
width: calc(50% - 0.35rem);
|
||||
background: var(--active-color);
|
||||
border-radius: 0.75rem;
|
||||
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.tab-indicator.on-right {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
.auth-body {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
animation: fadeIn 0.4s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.auth-footer {
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.auth-footer p {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.6;
|
||||
margin: 0;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -347,7 +347,7 @@ function clearMapMarkers() {
|
||||
}
|
||||
|
||||
function reDrawUserMarker() {
|
||||
if (!userCoords.value) return;
|
||||
if (!userCoords.value || !map.value) return;
|
||||
|
||||
// Remove old one if exists (paranoia)
|
||||
if (userMarker.value && typeof userMarker.value.setMap === 'function') {
|
||||
@ -379,6 +379,7 @@ async function updateMapMarkers(skipZoom = false) {
|
||||
// Llamar al procesador de flujo principal, lo cual limpia el mapa y centra.
|
||||
// Usamos skipZoom para evitar la animación intrusiva de búsqueda cuando no es desde el buscador
|
||||
await procesarSeleccionDeRuta(selectedRouteObj, stops as BusStop[], map.value, skipZoom);
|
||||
reDrawUserMarker();
|
||||
|
||||
// ⛔ ABORTAR SI EL USUARIO LIMPIÓ EL MAPA MIENTRAS DIBUJÁBAMOS
|
||||
if (routeStore.selectedRouteId !== currentRequestRouteId) {
|
||||
|
||||
Reference in New Issue
Block a user