Skip to content

Commit

Permalink
revert: add password entropy stength bar back in to signup (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght authored Aug 28, 2024
1 parent 46d6ab9 commit e67f135
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/form/SignUpForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { ApolloError, useApolloClient } from '@apollo/client';
import stringEntropy from 'fast-password-entropy';
import { ArrowLeft, Eye, EyeOff, Loader2 } from 'lucide-react';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
Expand All @@ -22,6 +23,7 @@ import { WorkerMessage, WorkerResponse } from '@/workers/account/types';
import { Button } from '../ui/button-v2';
import { Checkbox } from '../ui/checkbox';
import { Label } from '../ui/label';
import { Progress } from '../ui/progress';
import { useToast } from '../ui/use-toast';
import { WaitlistForm } from './WaitlistForm';

Expand Down Expand Up @@ -55,6 +57,8 @@ export function SignUpForm() {
const [acceptTermsAndPrivacy, setAcceptTermsAndPrivacy] = useState(false);
const [acceptPasswordWarning, setAcceptPasswordWarning] = useState(false);

const entropy = stringEntropy(password);

const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();

Expand Down Expand Up @@ -284,6 +288,8 @@ export function SignUpForm() {
</button>
</div>

<Progress value={Math.min(100, (entropy || 0) / 2)} />

<p className="text-sm text-neutral-400">{s('important')}</p>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const Progress = React.forwardRef<
<ProgressPrimitive.Root
ref={ref}
className={cn(
'relative h-2 w-full overflow-hidden rounded-full bg-primary/20',
'relative h-2 w-full overflow-hidden rounded-full bg-primary-v2/20',
className
)}
{...props}
>
<ProgressPrimitive.Indicator
className="h-full w-full flex-1 bg-primary transition-all"
className="h-full w-full flex-1 bg-primary-v2 transition-all"
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
Expand Down

0 comments on commit e67f135

Please sign in to comment.