-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue where error is displayed after resetting password
- Loading branch information
Showing
12 changed files
with
90 additions
and
60 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
23 changes: 23 additions & 0 deletions
23
src/components/forms/ForgotPasswordForm/ForgotPassword.tsx
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,23 @@ | ||
interface ForgotPasswordProp { | ||
didReset: boolean; | ||
loading: boolean; | ||
} | ||
|
||
export function ForgotPassword({ didReset, loading }: ForgotPasswordProp) { | ||
if (didReset) { | ||
return <p>You should receive an email if your account exists.</p>; | ||
} | ||
|
||
return <div className="field"> | ||
<div className="control" style={{ width: '100%' }}> | ||
<button | ||
type="submit" | ||
className="button is-link is-medium" | ||
style={{ width: '100%' }} | ||
disabled={loading} | ||
> | ||
Reset my password | ||
</button> | ||
</div> | ||
</div>; | ||
} |
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,7 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const FormContainer = styled.div` | ||
max-width: 720px; | ||
margin: 0 auto; | ||
`; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const isLoginPage = (path: string) => path.includes('/login'); | ||
const isForgotPasswordPage = (path: string) => path.includes('/forgot'); | ||
|
||
export const isSimplePage = () => window.location.pathname.endsWith('simple'); | ||
|
||
export const canShowNavbar = (path: string) => | ||
!isLoginPage(path) && !isSimplePage(); | ||
!isLoginPage(path) && !isSimplePage() && !isForgotPasswordPage(path); |
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,24 @@ | ||
import ForgotPasswordForm from '../../components/forms/ForgotPasswordForm/ForgotPasswordForm'; | ||
import NavButtonCTA from '../../components/buttons/NavButtonCTA'; | ||
import { Container } from '../../components/styled'; | ||
import TopSection from './TopSection'; | ||
import { ErrorHandlerType } from '../../components/errors/helpers/getErrorMessage'; | ||
|
||
interface Props { | ||
setErrorMessage: ErrorHandlerType; | ||
} | ||
|
||
export function ForgotPasswordPage({ setErrorMessage }: Props) { | ||
const onClickRegister = () => { | ||
window.location.href = '/register'; | ||
}; | ||
return ( | ||
<Container> | ||
<TopSection onClick={onClickRegister}> | ||
Don't have an account? | ||
<NavButtonCTA href="/register">Register</NavButtonCTA> | ||
</TopSection> | ||
<ForgotPasswordForm setError={setErrorMessage} /> | ||
</Container> | ||
); | ||
} |
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,11 @@ | ||
import styled from 'styled-components'; | ||
|
||
const TopSection = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
grid-gap: 1rem; | ||
padding: 1rem; | ||
`; | ||
|
||
export default TopSection; |
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,3 @@ | ||
import { ForgotPasswordPage } from './ForgotPasswordPage'; | ||
|
||
export default ForgotPasswordPage; |
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