-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): add reset password functionality (#98)
* feat(auth): add reset password functionality * Fixes
- Loading branch information
Showing
33 changed files
with
381 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
SUPABASE_URL=https://<your_supabase_url>.supabase.co | ||
SUPABASE_ANON_KEY=<your_supabase_anon_key> | ||
# These are received when running `yarn db:start` or `yarn db:status` | ||
# and are only required for running the local Supabase instance. | ||
# Habitrack UI is still runnable without these values. | ||
SUPABASE_URL=https://<your-supabase-url>.supabase.co | ||
SUPABASE_ANON_KEY=<your-supabase-anon_key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare let SUPABASE_URL: string; | ||
declare let SUPABASE_ANON_KEY: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Button, Input } from '@nextui-org/react'; | ||
import { Eye, EyeSlash } from '@phosphor-icons/react'; | ||
import React, { type ChangeEventHandler } from 'react'; | ||
|
||
type PasswordInputProps = { | ||
variant?: 'flat' | 'bordered' | 'faded' | 'underlined'; | ||
value: string; | ||
onChange: ChangeEventHandler<HTMLInputElement>; | ||
label: string; | ||
isDisabled: boolean; | ||
onReset?: () => void; | ||
testId?: string; | ||
}; | ||
|
||
const PasswordInput = ({ | ||
variant = 'flat', | ||
value, | ||
onChange, | ||
label, | ||
isDisabled, | ||
onReset, | ||
testId = '', | ||
}: PasswordInputProps) => { | ||
const [isVisible, setIsVisible] = React.useState(false); | ||
|
||
const toggleVisibility = () => { | ||
setIsVisible((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<Input | ||
classNames={{ | ||
description: 'text-right', | ||
}} | ||
description={ | ||
onReset ? ( | ||
<Button | ||
className="h-auto bg-transparent p-0 text-gray-400 hover:text-gray-700" | ||
onClick={onReset} | ||
disableAnimation | ||
> | ||
Forgot password? | ||
</Button> | ||
) : null | ||
} | ||
variant={variant} | ||
value={value} | ||
onChange={onChange} | ||
label={label} | ||
isDisabled={isDisabled} | ||
type={isVisible ? 'text' : 'password'} | ||
endContent={ | ||
<button | ||
className="focus:outline-none" | ||
type="button" | ||
onClick={toggleVisibility} | ||
aria-label="toggle password visibility" | ||
> | ||
{isVisible ? ( | ||
<EyeSlash className="pointer-events-none text-2xl text-default-400" /> | ||
) : ( | ||
<Eye className="pointer-events-none text-2xl text-default-400" /> | ||
)} | ||
</button> | ||
} | ||
data-testid={testId} | ||
/> | ||
); | ||
}; | ||
|
||
export default PasswordInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './PasswordInput'; | ||
export { default as PasswordInput } from './PasswordInput'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './ConfirmDialog'; | ||
export * from './VisuallyHiddenInput'; | ||
export * from './PasswordInput'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.