Skip to content

Commit 837b302

Browse files
authored
Merge pull request #19 from whythawk/floating-magic-login
New floating magic login
2 parents 7a99119 + 18d825b commit 837b302

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<div v-if="!auth.loggedIn" class="py-12 sm:py-20">
3+
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
4+
<div
5+
class="relative isolate flex flex-col gap-10 overflow-hidden bg-gray-900 px-6 py-16 shadow-2xl sm:rounded-xl sm:px-24 xl:flex-row xl:items-center xl:py-20">
6+
<h2 class="max-w-2xl text-3xl font-bold tracking-tight text-white sm:text-4xl xl:max-w-none xl:flex-auto">
7+
{{ props.cardText }}</h2>
8+
<Form @submit="submit" :validation-schema="schema" class="w-full max-w-md">
9+
<div class="flex gap-x-4">
10+
<label for="email-address" class="sr-only">Email address</label>
11+
<Field id="email" name="email" type="email" autocomplete="email" placeholder="Enter your email"
12+
class="min-w-0 flex-auto rounded-md border-0 bg-white/5 px-3.5 py-2 text-white shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-white sm:text-sm sm:leading-6" />
13+
<ErrorMessage name="email"
14+
class="absolute left-5 top-5 translate-y-full w-48 px-2 py-1 bg-gray-700 rounded-lg text-center text-white text-sm after:content-[''] after:absolute after:left-1/2 after:bottom-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-t-transparent after:border-b-gray-700" />
15+
<button type="submit"
16+
class="flex-none rounded-md bg-white py-2.5 px-3.5 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white">
17+
Sign-up
18+
</button>
19+
</div>
20+
<p class="mt-4 text-sm leading-6 text-gray-300">We care about your data. Read our <NuxtLink to="/privacy"
21+
class="font-semibold text-white">privacy policy</NuxtLink>.</p>
22+
</Form>
23+
<svg viewBox="0 0 1024 1024" class="absolute top-1/2 left-1/2 -z-10 h-[64rem] w-[64rem] -translate-x-1/2"
24+
aria-hidden="true">
25+
<circle cx="512" cy="512" r="512" fill="url(#759c1415-0410-454c-8f7c-9a820de03641)" fill-opacity="0.7" />
26+
<defs>
27+
<radialGradient id="759c1415-0410-454c-8f7c-9a820de03641" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse"
28+
gradientTransform="translate(512 512) rotate(90) scale(512)">
29+
<stop stop-color="#932122" />
30+
<stop offset="1" stop-color="#fbcdcd" stop-opacity="0" />
31+
</radialGradient>
32+
</defs>
33+
</svg>
34+
</div>
35+
</div>
36+
</div>
37+
</template>
38+
39+
<script setup lang="ts">
40+
import { useAuthStore } from "@/stores"
41+
import { tokenParser, tokenIsTOTP } from "@/utilities"
42+
43+
const props = defineProps({
44+
cardText: String
45+
})
46+
47+
const auth = useAuthStore()
48+
const redirectAfterMagic = "/magic"
49+
const redirectTOTP = "/totp"
50+
51+
const schema = {
52+
email: { email: true, required: true },
53+
password: { min: 8, max: 64 },
54+
}
55+
56+
async function submit(values: any) {
57+
await auth.logIn({ username: values.email, password: values.password })
58+
if (auth.authTokens.token && tokenIsTOTP(auth.authTokens.token))
59+
return await navigateTo(redirectTOTP)
60+
if (auth.authTokens.token &&
61+
tokenParser(auth.authTokens.token).hasOwnProperty("fingerprint"))
62+
return await navigateTo(redirectAfterMagic)
63+
}
64+
</script>
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Your privacy
3+
description: "We at [Website Name] value your privacy as much as we value a cheap joke."
4+
navigation: false
5+
---
6+
7+
# Your privacy and rights
8+
9+
Welcome to [Website Name], the online version of a hallucination induced by eating too much cheese. Here's what you can expect when you use our website:
10+
11+
## Privacy policy
12+
13+
- We'll collect every piece of personal information you have, including your name, address, phone number, email, social security number, credit card details, and your mother's maiden name. We'll also peek into your browser history, your text messages, and your dreams (if we can find the right mushrooms).
14+
- We promise to use your data for twisted and bizarre purposes only, like cloning you and making you fight your clone to the death, using your DNA to create a race of superhumans, or summoning a demon that looks like your grandma.
15+
- We'll use your information to spam you with ads that are so surreal and disorienting, you'll think you're trapped in a Salvador Dali painting. We'll also use it to mess with your mind, make you question reality, and possibly even inspire you to start a cult (which we'll join, of course).
16+
- We'll store your data in a realm of pure chaos and madness, guarded by an army of chimeras, goblins, and robots that have gone rogue. We'll also share your data with our interdimensional overlords, who are always hungry for new sources of entertainment.
17+
- We'll use cookies to track your every move online, and we'll use that information to create a digital avatar of you that's even weirder and more unpredictable than the real you. We'll also use cookies to play pranks on you, like making your cursor turn into a banana or making your keyboard explode (don't worry, it's just a harmless little explosion).
18+
19+
## GDPR
20+
21+
We don't care about GDPR or any other earthly laws. Our website operates in a dimension beyond your feeble human concepts of order and justice. If you try to sue us, we'll just laugh and summon a horde of poltergeists to haunt you for eternity.
22+
23+
## Liability
24+
25+
By using our website, you agree to relinquish all control over your sanity, your identity, and your soul. You acknowledge that our website is a portal to a universe of madness and mayhem, and that you are entering at your own risk. We're not liable for any psychological, spiritual, or metaphysical damage that may result from using our website. But hey, at least you'll have a good story to tell the angels (or the demons, depending on how things turn out).
26+
27+
Thank you for choosing [Website Name], where the rules of logic and reality are optional, and the nightmares are free of charge.
28+
29+
_(Yes, generated by ChatGPT. Replace this with something meaningful.)

0 commit comments

Comments
 (0)