-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Update user registration flow (#168)
* Added pagination component with useQuery call connected * tested on mock data, working without useeffect * Pagination cleanup - ermoved Resources/Resources.js file, only show pagination component when there is no search term, and moved it down on the page * register and login api updated * login and registration apis working now, error handling tmp patch * [Security] Bump axios from 0.19.0 to 0.21.1 Bumps [axios](https://github.com/axios/axios) from 0.19.0 to 0.21.1. **This update includes a security fix.** - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md) - [Commits](axios/axios@v0.19.0...v0.21.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Add constants file and differentiate between dev and prod for the API host URL * fixed tests * verify email post request working * error validation on verify email screen * Update src/components/Auth/SignUpForm.js Co-authored-by: Linda <[email protected]> * Add key to dependencies array for useEffect * Added explanatory text re: verifying email Co-authored-by: Linda Peng <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Linda <[email protected]>
- Loading branch information
1 parent
2d41259
commit 9112cc3
Showing
8 changed files
with
146 additions
and
117 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
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 |
---|---|---|
|
@@ -55,24 +55,28 @@ describe('Signup', () => { | |
username: 'Carolyne.Carter', | ||
token: | ||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IkNhcm9seW5lLkNhcnRlciIsImlhdCI6MTU4NDMzODQ4NiwiZXhwIjoxNTg0MzQyMDg2LCJ1c2VyX2lkIjo4MCwib3JpZ19pYXQiOjE1ODQzMzg0ODZ9.saO6OCOKV1uwHjTbM-iDGmhbkMNCnzrGFj4TBYnTv2E', | ||
first_name: 'Carolyne', | ||
last_name: 'Carter', | ||
// first_name: 'Carolyne', | ||
// last_name: 'Carter', | ||
email: '[email protected]', | ||
password1: 'password', | ||
password2: 'password', | ||
}, | ||
}); | ||
|
||
userEvent.type(screen.getByLabelText(/username/i), 'Carolyne.Carter'); | ||
userEvent.type(screen.getByLabelText('Username*'), 'Carolyne.Carter'); | ||
|
||
userEvent.type(screen.getByLabelText(/password/i), 'password'); | ||
userEvent.type(screen.getByLabelText('Password*'), 'password'); | ||
|
||
userEvent.type(screen.getByLabelText('Confirm Password*'), 'password'); | ||
|
||
userEvent.type( | ||
screen.getByLabelText(/email/i), | ||
screen.getByLabelText('Email*'), | ||
'[email protected]' | ||
); | ||
|
||
userEvent.type(screen.getByLabelText(/first name/i), 'Carolyne'); | ||
// userEvent.type(screen.getByLabelText(/first name/i), 'Carolyne'); | ||
|
||
userEvent.type(screen.getByLabelText(/last name/i), 'Carter'); | ||
// userEvent.type(screen.getByLabelText(/last name/i), 'Carter'); | ||
|
||
userEvent.click(screen.getByText('Sign Up')); | ||
|
||
|
@@ -129,15 +133,15 @@ describe('Login', () => { | |
data: { | ||
token: | ||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IkNhcm9seW5lLkNhcnRlciIsImlhdCI6MTU4NDM0MDAyMiwiZXhwIjoxNTg0MzQzNjIyLCJ1c2VyX2lkIjo4MCwib3JpZ19pYXQiOjE1ODQzNDAwMjJ9.0zNlXPVAjkBjxUQjq4B0HXnvrez93H2pz6n2ROKWzzg', | ||
username: 'Carolyne.Carter', | ||
email: 'Carolyne.Carter@mail.com', | ||
}, | ||
}); | ||
|
||
await act(async () => | ||
userEvent.type(getByLabelText(/username/i), 'Carolyne.Carter') | ||
userEvent.type(getByLabelText(/email/i), 'Carolyne.Carter@mail.com') | ||
); | ||
await act(async () => | ||
userEvent.type(getByLabelText(/username/i), 'Carolyne.Carter') | ||
userEvent.type(getByLabelText(/email/i), 'Carolyne.Carter@mail.com') | ||
); | ||
|
||
await act(async () => | ||
|
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import axios from 'axios'; | ||
import { Link } from 'react-router-dom'; | ||
import { config } from '../../helpers/constants'; | ||
|
||
const VerifyEmail = () => { | ||
const [verifyStatus, setVerifyStatus] = useState(''); | ||
const [error, setError] = useState(''); | ||
const urlParams = new URLSearchParams(window.location.search); | ||
const key = urlParams.get('key'); | ||
|
||
useEffect(() => { | ||
if (key) { | ||
axios | ||
.post(`${config.API_URL}/api/v1/auth/registration/verify-email/`, { | ||
key, | ||
}) | ||
.then(resp => { | ||
if (resp.status === 200) { | ||
setVerifyStatus('Your email has been verified!'); | ||
} | ||
}) | ||
.catch(e => { | ||
console.error(e); | ||
setError(e.message); | ||
}); | ||
} else { | ||
setError('There is no key in the URL.'); | ||
} | ||
}, [key]); | ||
|
||
return ( | ||
<div> | ||
<div> | ||
{verifyStatus ? ( | ||
<span>{`${verifyStatus}`}</span> | ||
) : ( | ||
<p> | ||
Thank you for signing up! Please check your email to verify your | ||
account. | ||
</p> | ||
)} | ||
{error && <span style={{ color: 'red' }}>{`${error}`}</span>} | ||
<br /> | ||
<Link to="/">Home</Link> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default VerifyEmail; |
Oops, something went wrong.