feat(auth): Add 11-tap secret login shortcut
This commit is contained in:
parent
c74f37783f
commit
5482676f06
1 changed files with 33 additions and 2 deletions
|
|
@ -92,11 +92,42 @@ export default function LoginPage() {
|
||||||
className="w-full max-w-sm space-y-12"
|
className="w-full max-w-sm space-y-12"
|
||||||
>
|
>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<motion.div variants={itemVariants} className="lg:hidden relative group w-fit mb-8">
|
<motion.div
|
||||||
|
variants={itemVariants}
|
||||||
|
className="lg:hidden relative group w-fit mb-8 select-none active:scale-95 transition-transform"
|
||||||
|
onClick={async () => {
|
||||||
|
const now = Date.now();
|
||||||
|
const windowTime = 5000; // 5 seconds to tap 11 times
|
||||||
|
|
||||||
|
// Reset if too much time passed
|
||||||
|
if ((window as any).lastTap && now - (window as any).lastTap > 1000) {
|
||||||
|
(window as any).tapCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
(window as any).lastTap = now;
|
||||||
|
(window as any).tapCount = ((window as any).tapCount || 0) + 1;
|
||||||
|
|
||||||
|
if ((window as any).tapCount >= 11) {
|
||||||
|
(window as any).tapCount = 0;
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const { data } = await api.post('/auth/login', {
|
||||||
|
email: 'tenwest@proton.me',
|
||||||
|
password: '2GreenSlugs!'
|
||||||
|
});
|
||||||
|
login(data.accessToken, data.refreshToken, data.user);
|
||||||
|
navigate('/dashboard');
|
||||||
|
} catch (err: any) {
|
||||||
|
setError('Auto-login failed.');
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src="/assets/logo-veridian.png"
|
src="/assets/logo-veridian.png"
|
||||||
alt="Veridian"
|
alt="Veridian"
|
||||||
className="w-12 h-12 rounded-xl shadow-lg transition-transform duration-300 group-hover:scale-105"
|
className="w-12 h-12 rounded-xl shadow-lg transition-transform duration-300 group-hover:scale-105 pointer-events-none"
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-0 rounded-xl bg-[var(--color-primary)] opacity-0 group-hover:opacity-10 transition-opacity blur-lg" />
|
<div className="absolute inset-0 rounded-xl bg-[var(--color-primary)] opacity-0 group-hover:opacity-10 transition-opacity blur-lg" />
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue