| [92e7c7a] | 1 | <template>
|
|---|
| 2 | <main class="auth-wrap">
|
|---|
| 3 | <!-- animated blobs -->
|
|---|
| 4 | <div class="blob blob-1" aria-hidden="true"></div>
|
|---|
| 5 | <div class="blob blob-2" aria-hidden="true"></div>
|
|---|
| 6 |
|
|---|
| 7 | <div class="auth-card card border-0 shadow-lg">
|
|---|
| 8 | <div class="card-body p-4 p-md-5">
|
|---|
| 9 | <!-- Header -->
|
|---|
| 10 | <div class="d-flex align-items-center gap-3 mb-4">
|
|---|
| 11 | <div class="brand-badge" aria-hidden="true">
|
|---|
| 12 | <!-- paw -->
|
|---|
| 13 | <svg width="22" height="22" viewBox="0 0 24 24" fill="none">
|
|---|
| 14 | <path
|
|---|
| 15 | d="M7.6 10.2c-1.1 0-2-.98-2-2.2s.9-2.2 2-2.2 2 .98 2 2.2-.9 2.2-2 2.2Zm8.8 0c-1.1 0-2-.98-2-2.2s.9-2.2 2-2.2 2 .98 2 2.2-.9 2.2-2 2.2ZM10 8.2c-1 0-1.8-.9-1.8-2s.8-2 1.8-2 1.8.9 1.8 2-.8 2-1.8 2Zm4 0c-1 0-1.8-.9-1.8-2s.8-2 1.8-2 1.8.9 1.8 2-.8 2-1.8 2ZM12 21c-2.6 0-5.6-1.6-5.6-4.5 0-2.2 1.9-3.7 3.9-3.7.8 0 1.4.2 1.7.5.3-.3.9-.5 1.7-.5 2 0 3.9 1.5 3.9 3.7C17.6 19.4 14.6 21 12 21Z"
|
|---|
| 16 | fill="currentColor"
|
|---|
| 17 | opacity=".92"
|
|---|
| 18 | />
|
|---|
| 19 | </svg>
|
|---|
| 20 | </div>
|
|---|
| 21 |
|
|---|
| 22 | <div class="flex-grow-1">
|
|---|
| 23 | <h1 class="h4 mb-1 title">Welcome back</h1>
|
|---|
| 24 | <p class="text-muted mb-0">Log in to manage your Petify account.</p>
|
|---|
| 25 | </div>
|
|---|
| 26 | </div>
|
|---|
| 27 |
|
|---|
| 28 | <!-- Error -->
|
|---|
| 29 | <div v-if="error" class="alert alert-danger auth-alert" role="alert">
|
|---|
| 30 | <strong class="me-1">Oops.</strong>{{ error }}
|
|---|
| 31 | </div>
|
|---|
| 32 |
|
|---|
| 33 | <form @submit.prevent="submit" class="mt-3">
|
|---|
| 34 | <!-- Username -->
|
|---|
| 35 | <div class="mb-3">
|
|---|
| 36 | <label class="form-label" for="username">Username</label>
|
|---|
| 37 | <div class="input-group auth-input">
|
|---|
| 38 | <span class="input-group-text">
|
|---|
| 39 | <!-- user -->
|
|---|
| 40 | <svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|---|
| 41 | <path
|
|---|
| 42 | d="M12 12a4.5 4.5 0 1 0-4.5-4.5A4.5 4.5 0 0 0 12 12Zm0 2.25c-4.42 0-8 2.24-8 5v.75h16v-.75c0-2.76-3.58-5-8-5Z"
|
|---|
| 43 | fill="currentColor"
|
|---|
| 44 | opacity=".85"
|
|---|
| 45 | />
|
|---|
| 46 | </svg>
|
|---|
| 47 | </span>
|
|---|
| 48 | <input
|
|---|
| 49 | id="username"
|
|---|
| 50 | v-model.trim="username"
|
|---|
| 51 | class="form-control"
|
|---|
| 52 | type="text"
|
|---|
| 53 | autocomplete="username"
|
|---|
| 54 | required
|
|---|
| 55 | placeholder="e.g. username123"
|
|---|
| 56 | />
|
|---|
| 57 | </div>
|
|---|
| 58 | </div>
|
|---|
| 59 |
|
|---|
| 60 | <!-- Password + show/hide -->
|
|---|
| 61 | <div class="mb-2">
|
|---|
| 62 | <label class="form-label" for="password">Password</label>
|
|---|
| 63 |
|
|---|
| 64 | <div class="input-group auth-input">
|
|---|
| 65 | <span class="input-group-text">
|
|---|
| 66 | <!-- lock -->
|
|---|
| 67 | <svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|---|
| 68 | <path
|
|---|
| 69 | d="M17 10h-1V8a4 4 0 0 0-8 0v2H7a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7a2 2 0 0 0-2-2Zm-7-2a2 2 0 0 1 4 0v2h-4V8Z"
|
|---|
| 70 | fill="currentColor"
|
|---|
| 71 | opacity=".85"
|
|---|
| 72 | />
|
|---|
| 73 | </svg>
|
|---|
| 74 | </span>
|
|---|
| 75 |
|
|---|
| 76 | <input
|
|---|
| 77 | id="password"
|
|---|
| 78 | v-model="password"
|
|---|
| 79 | class="form-control"
|
|---|
| 80 | :type="showPassword ? 'text' : 'password'"
|
|---|
| 81 | autocomplete="current-password"
|
|---|
| 82 | required
|
|---|
| 83 | minlength="6"
|
|---|
| 84 | placeholder="••••••••"
|
|---|
| 85 | />
|
|---|
| 86 |
|
|---|
| 87 | <button
|
|---|
| 88 | class="btn btn-eye"
|
|---|
| 89 | type="button"
|
|---|
| 90 | :aria-label="showPassword ? 'Hide password' : 'Show password'"
|
|---|
| 91 | :title="showPassword ? 'Hide password' : 'Show password'"
|
|---|
| 92 | @click="togglePassword"
|
|---|
| 93 | >
|
|---|
| 94 | <!-- eye / eye-off -->
|
|---|
| 95 | <svg v-if="!showPassword" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|---|
| 96 | <path
|
|---|
| 97 | d="M12 5c5.5 0 9.5 5.5 9.5 7s-4 7-9.5 7S2.5 14.5 2.5 12 6.5 5 12 5Zm0 2C8 7 4.9 10.8 4.9 12S8 17 12 17s7.1-3.8 7.1-5S16 7 12 7Zm0 2.5A2.5 2.5 0 1 1 9.5 12 2.5 2.5 0 0 1 12 9.5Z"
|
|---|
| 98 | fill="currentColor"
|
|---|
| 99 | opacity=".85"
|
|---|
| 100 | />
|
|---|
| 101 | </svg>
|
|---|
| 102 | <svg v-else width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|---|
| 103 | <path
|
|---|
| 104 | d="M3.3 4.7 4.7 3.3l16 16-1.4 1.4-2.3-2.3c-1.4.8-3 1.3-4.9 1.3-5.5 0-9.5-5.5-9.5-7 0-1.2 2.2-4.3 5.7-6.1L3.3 4.7ZM12 7c-.9 0-1.8.2-2.6.5l1.7 1.7c.3-.1.6-.2.9-.2A2.5 2.5 0 0 1 14.5 12c0 .3-.1.6-.2.9l1.7 1.7c.3-.8.5-1.7.5-2.6 0-3-2.4-5-4.5-5Zm0 10c.9 0 1.8-.2 2.6-.5l-1.7-1.7c-.3.1-.6.2-.9.2A2.5 2.5 0 0 1 9.5 12c0-.3.1-.6.2-.9L8 9.4c-.3.8-.5 1.7-.5 2.6 0 3 2.4 5 4.5 5Zm0-12c5.5 0 9.5 5.5 9.5 7 0 .8-1.3 2.8-3.4 4.5l-1.4-1.4c1.7-1.4 2.4-2.8 2.4-3.1 0-1.2-3.1-5-7.1-5-1.2 0-2.3.3-3.3.7L7.2 6.3C8.6 5.5 10.2 5 12 5Z"
|
|---|
| 105 | fill="currentColor"
|
|---|
| 106 | opacity=".85"
|
|---|
| 107 | />
|
|---|
| 108 | </svg>
|
|---|
| 109 | </button>
|
|---|
| 110 | </div>
|
|---|
| 111 | </div>
|
|---|
| 112 |
|
|---|
| 113 | <!-- Remember me -->
|
|---|
| 114 | <div class="d-flex justify-content-between align-items-center mt-2 mb-3">
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 | <!-- enable later if you implement route -->
|
|---|
| 118 | <!-- <RouterLink class="link small accent" to="/forgot">Forgot password?</RouterLink> -->
|
|---|
| 119 | </div>
|
|---|
| 120 |
|
|---|
| 121 | <!-- CTA -->
|
|---|
| 122 | <button class="btn btn-primary w-100 btn-orange" type="submit" :disabled="loading">
|
|---|
| 123 | <span v-if="loading" class="spinner-border spinner-border-sm me-2" aria-hidden="true"></span>
|
|---|
| 124 | {{ loading ? 'Logging in…' : 'Log in' }}
|
|---|
| 125 | </button>
|
|---|
| 126 | </form>
|
|---|
| 127 |
|
|---|
| 128 | <!-- Footer links -->
|
|---|
| 129 | <div class="d-flex justify-content-between mt-4">
|
|---|
| 130 | <RouterLink class="link subtle" to="/">Back to listings</RouterLink>
|
|---|
| 131 | <RouterLink class="link accent" to="/signup">Create account</RouterLink>
|
|---|
| 132 | </div>
|
|---|
| 133 | </div>
|
|---|
| 134 | </div>
|
|---|
| 135 |
|
|---|
| 136 | <p class="text-center mt-3 small text-muted mb-0">
|
|---|
| 137 | By logging in you agree to treat pets with kindness 🧡
|
|---|
| 138 | </p>
|
|---|
| 139 | </main>
|
|---|
| 140 | </template>
|
|---|
| 141 |
|
|---|
| 142 | <script setup lang="ts">
|
|---|
| 143 | import { ref } from 'vue'
|
|---|
| 144 | import { useRoute, useRouter } from 'vue-router'
|
|---|
| 145 | import { useAuthStore } from '../stores/auth'
|
|---|
| 146 |
|
|---|
| 147 | const auth = useAuthStore()
|
|---|
| 148 | const router = useRouter()
|
|---|
| 149 | const route = useRoute()
|
|---|
| 150 |
|
|---|
| 151 | const username = ref('')
|
|---|
| 152 | const password = ref('')
|
|---|
| 153 | const loading = ref(false)
|
|---|
| 154 | const error = ref<string | null>(null)
|
|---|
| 155 |
|
|---|
| 156 | const showPassword = ref(false)
|
|---|
| 157 | const rememberMe = ref(true)
|
|---|
| 158 |
|
|---|
| 159 | function togglePassword() {
|
|---|
| 160 | showPassword.value = !showPassword.value
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | async function submit() {
|
|---|
| 164 | error.value = null
|
|---|
| 165 | loading.value = true
|
|---|
| 166 | try {
|
|---|
| 167 | // If you want to actually persist "remember me", hook this into your auth store
|
|---|
| 168 | // (e.g., store token in localStorage vs sessionStorage).
|
|---|
| 169 | await auth.login({ username: username.value, password: password.value })
|
|---|
| 170 |
|
|---|
| 171 | const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : '/'
|
|---|
| 172 | await router.replace(redirect)
|
|---|
| 173 | } catch (e) {
|
|---|
| 174 | error.value = e instanceof Error ? e.message : String(e)
|
|---|
| 175 | } finally {
|
|---|
| 176 | loading.value = false
|
|---|
| 177 | }
|
|---|
| 178 | }
|
|---|
| 179 | </script>
|
|---|
| 180 |
|
|---|
| 181 | <style scoped>
|
|---|
| 182 | /* Theme tokens */
|
|---|
| 183 | .auth-wrap {
|
|---|
| 184 | --petify-orange: #ff7a18;
|
|---|
| 185 | --petify-orange-2: #ff9a3d;
|
|---|
| 186 | --petify-ink: #1f2937;
|
|---|
| 187 |
|
|---|
| 188 | position: relative;
|
|---|
| 189 | overflow: hidden;
|
|---|
| 190 | min-height: 100vh;
|
|---|
| 191 | display: grid;
|
|---|
| 192 | place-items: center;
|
|---|
| 193 | padding: 3rem 1rem;
|
|---|
| 194 |
|
|---|
| 195 | background:
|
|---|
| 196 | radial-gradient(1200px 600px at 15% 0%, rgba(255, 122, 24, 0.18), transparent 60%),
|
|---|
| 197 | radial-gradient(900px 500px at 95% 15%, rgba(255, 154, 61, 0.14), transparent 55%),
|
|---|
| 198 | linear-gradient(180deg, #fff7f0 0%, #ffffff 45%, #ffffff 100%);
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 | /* Animated blobs */
|
|---|
| 202 | .blob {
|
|---|
| 203 | position: absolute;
|
|---|
| 204 | width: 520px;
|
|---|
| 205 | height: 520px;
|
|---|
| 206 | border-radius: 999px;
|
|---|
| 207 | filter: blur(42px);
|
|---|
| 208 | opacity: 0.55;
|
|---|
| 209 | pointer-events: none;
|
|---|
| 210 | mix-blend-mode: multiply;
|
|---|
| 211 | animation: floaty 10s ease-in-out infinite;
|
|---|
| 212 | background: radial-gradient(circle at 30% 30%, rgba(255, 122, 24, 0.55), rgba(255, 154, 61, 0.12));
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | .blob-1 {
|
|---|
| 216 | top: -220px;
|
|---|
| 217 | left: -220px;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | .blob-2 {
|
|---|
| 221 | bottom: -240px;
|
|---|
| 222 | right: -240px;
|
|---|
| 223 | animation-delay: -3.5s;
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | @keyframes floaty {
|
|---|
| 227 | 0% {
|
|---|
| 228 | transform: translate3d(0, 0, 0) scale(1);
|
|---|
| 229 | }
|
|---|
| 230 | 50% {
|
|---|
| 231 | transform: translate3d(28px, 18px, 0) scale(1.06);
|
|---|
| 232 | }
|
|---|
| 233 | 100% {
|
|---|
| 234 | transform: translate3d(0, 0, 0) scale(1);
|
|---|
| 235 | }
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | /* Card */
|
|---|
| 239 | .auth-card {
|
|---|
| 240 | width: 100%;
|
|---|
| 241 | max-width: 520px;
|
|---|
| 242 | border-radius: 18px;
|
|---|
| 243 | overflow: hidden;
|
|---|
| 244 | position: relative;
|
|---|
| 245 | z-index: 1;
|
|---|
| 246 | backdrop-filter: blur(6px);
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | /* top accent strip */
|
|---|
| 250 | .auth-card::before {
|
|---|
| 251 | content: "";
|
|---|
| 252 | position: absolute;
|
|---|
| 253 | inset: 0 0 auto 0;
|
|---|
| 254 | height: 6px;
|
|---|
| 255 | background: linear-gradient(90deg, var(--petify-orange), var(--petify-orange-2));
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | .title {
|
|---|
| 259 | color: var(--petify-ink);
|
|---|
| 260 | letter-spacing: -0.2px;
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 | .brand-badge {
|
|---|
| 264 | width: 46px;
|
|---|
| 265 | height: 46px;
|
|---|
| 266 | border-radius: 14px;
|
|---|
| 267 | display: grid;
|
|---|
| 268 | place-items: center;
|
|---|
| 269 | color: #fff;
|
|---|
| 270 | background: linear-gradient(135deg, var(--petify-orange), var(--petify-orange-2));
|
|---|
| 271 | box-shadow: 0 10px 25px rgba(255, 122, 24, 0.28);
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | .auth-alert {
|
|---|
| 275 | border-radius: 12px;
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | /* Input styling */
|
|---|
| 279 | .auth-input .input-group-text {
|
|---|
| 280 | border-radius: 12px 0 0 12px;
|
|---|
| 281 | background: #fff;
|
|---|
| 282 | border-color: rgba(31, 41, 55, 0.12);
|
|---|
| 283 | color: rgba(31, 41, 55, 0.7);
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | .auth-input .form-control {
|
|---|
| 287 | border-radius: 0;
|
|---|
| 288 | border-color: rgba(31, 41, 55, 0.12);
|
|---|
| 289 | padding: 0.75rem 0.9rem;
|
|---|
| 290 | }
|
|---|
| 291 |
|
|---|
| 292 | .auth-input .form-control:focus {
|
|---|
| 293 | box-shadow: 0 0 0 0.25rem rgba(255, 122, 24, 0.18);
|
|---|
| 294 | border-color: rgba(255, 122, 24, 0.55);
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | /* Eye button */
|
|---|
| 298 | .btn-eye {
|
|---|
| 299 | border-radius: 0 12px 12px 0;
|
|---|
| 300 | border: 1px solid rgba(31, 41, 55, 0.12);
|
|---|
| 301 | border-left: 0;
|
|---|
| 302 | background: #fff;
|
|---|
| 303 | color: rgba(31, 41, 55, 0.7);
|
|---|
| 304 | padding: 0 0.85rem;
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 | .btn-eye:hover {
|
|---|
| 308 | color: rgba(31, 41, 55, 0.95);
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | .btn-eye:focus {
|
|---|
| 312 | box-shadow: 0 0 0 0.25rem rgba(255, 122, 24, 0.18);
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | /* Fix rounding for group with eye button */
|
|---|
| 316 | .auth-input .input-group-text {
|
|---|
| 317 | border-right: 0;
|
|---|
| 318 | }
|
|---|
| 319 | .auth-input .form-control {
|
|---|
| 320 | border-left: 0;
|
|---|
| 321 | }
|
|---|
| 322 | .auth-input .form-control:first-child {
|
|---|
| 323 | border-radius: 12px;
|
|---|
| 324 | }
|
|---|
| 325 | .auth-input .form-control {
|
|---|
| 326 | border-radius: 0;
|
|---|
| 327 | }
|
|---|
| 328 | .auth-input .btn-eye {
|
|---|
| 329 | border-left: 0;
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | /* Orange CTA button */
|
|---|
| 333 | .btn-orange {
|
|---|
| 334 | border: none;
|
|---|
| 335 | border-radius: 12px;
|
|---|
| 336 | padding: 0.8rem 1rem;
|
|---|
| 337 | font-weight: 600;
|
|---|
| 338 | background: linear-gradient(135deg, var(--petify-orange), var(--petify-orange-2));
|
|---|
| 339 | box-shadow: 0 12px 24px rgba(255, 122, 24, 0.25);
|
|---|
| 340 | }
|
|---|
| 341 |
|
|---|
| 342 | .btn-orange:disabled {
|
|---|
| 343 | opacity: 0.75;
|
|---|
| 344 | box-shadow: none;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | .btn-orange:hover {
|
|---|
| 348 | filter: brightness(0.98);
|
|---|
| 349 | }
|
|---|
| 350 |
|
|---|
| 351 | /* Links */
|
|---|
| 352 | .link {
|
|---|
| 353 | text-decoration: none;
|
|---|
| 354 | }
|
|---|
| 355 |
|
|---|
| 356 | .link.subtle {
|
|---|
| 357 | color: rgba(31, 41, 55, 0.75);
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| 360 | .link.subtle:hover {
|
|---|
| 361 | color: rgba(31, 41, 55, 0.95);
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | .link.accent {
|
|---|
| 365 | color: #ff7a18;
|
|---|
| 366 | font-weight: 600;
|
|---|
| 367 | }
|
|---|
| 368 |
|
|---|
| 369 | .link.accent:hover {
|
|---|
| 370 | color: #e76610;
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | /* Respect reduced motion */
|
|---|
| 374 | @media (prefers-reduced-motion: reduce) {
|
|---|
| 375 | .blob {
|
|---|
| 376 | animation: none;
|
|---|
| 377 | }
|
|---|
| 378 | }
|
|---|
| 379 | </style>
|
|---|