-
-
Notifications
You must be signed in to change notification settings - Fork 28
WIP Update user registration flow #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c00bc85
Added pagination component with useQuery call connected
pdotsani a51d55e
tested on mock data, working without useeffect
pdotsani da0d2a9
Pagination cleanup - ermoved Resources/Resources.js file, only show p…
446e669
register and login api updated
pdotsani 39bd218
login and registration apis working now, error handling tmp patch
pdotsani 500d653
[Security] Bump axios from 0.19.0 to 0.21.1
dependabot-preview[bot] 17a91b4
Add constants file and differentiate between dev and prod for the API…
6ac2361
fixed tests
pdotsani b43d75d
verify email post request working
pdotsani df55168
error validation on verify email screen
pdotsani e0c229d
Update src/components/Auth/SignUpForm.js
pdotsani bae0123
Add key to dependencies array for useEffect
a637bbf
Added explanatory text re: verifying email
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.