Skip to content
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

Email confirmation flow #522

Open
wants to merge 37 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b65595d
setup create course page
ZheleznovTN Apr 12, 2022
e40db72
implement content builder component
ZheleznovTN Apr 12, 2022
6e4760e
implement currency input component
ZheleznovTN Apr 12, 2022
793ae5e
fix breakpoints
ZheleznovTN Apr 14, 2022
53bed13
implement switch component
ZheleznovTN Apr 15, 2022
0c6ff31
implement switch formik field
ZheleznovTN Apr 18, 2022
99e51c4
setup redux store for courses
ZheleznovTN Apr 19, 2022
03dfa0d
setup course page
ZheleznovTN Apr 19, 2022
c19d3de
implement responsive component, implement course main info
ZheleznovTN Apr 19, 2022
aba5b53
setup content list component
ZheleznovTN Apr 19, 2022
b997fb0
implement members component
ZheleznovTN Apr 20, 2022
cc8f4ab
implement two columns grid component
ZheleznovTN Apr 20, 2022
34c4806
lessons, reviews, members, materials setup and empty states
ZheleznovTN Apr 20, 2022
0fda365
implement materials block
ZheleznovTN Apr 22, 2022
1c715bc
materials side modal
ZheleznovTN Apr 22, 2022
ae1e33c
implement action modal, refactoring
ZheleznovTN Apr 23, 2022
1ff3a3c
implement materials block
ZheleznovTN Apr 25, 2022
50b2ca6
implement reviews content block
ZheleznovTN Apr 25, 2022
a1270c0
implement all reviews side modal
ZheleznovTN Apr 25, 2022
382b35a
implement add review side modal
ZheleznovTN Apr 25, 2022
e47d670
Merge branch 'dev' into course-page
ZheleznovTN Apr 28, 2022
73a5a63
implement course progress bar component
ZheleznovTN Apr 29, 2022
4128ab8
implement course lesson item component
ZheleznovTN Apr 29, 2022
9512acd
implement progress list component and progress list component
ZheleznovTN May 1, 2022
85a5b2c
add more button to course main info container
ZheleznovTN May 1, 2022
e405787
implement course and lessons more options
ZheleznovTN May 1, 2022
eff4565
minor changes
ZheleznovTN May 3, 2022
d7fb377
implement members page
ZheleznovTN May 4, 2022
2c5ba00
Merge branch 'dev' into members-page
ZheleznovTN May 5, 2022
f838b03
implement confirmation email page
ZheleznovTN May 5, 2022
5ef8678
refactoring
ZheleznovTN May 5, 2022
f22f850
fixes to detect users for sign up confirmation
neil-sweetcodepro May 6, 2022
2bd6e57
implement non confirmed flow
ZheleznovTN May 9, 2022
3f3d8b2
implement loader provider
ZheleznovTN May 9, 2022
da47c95
fix login
ZheleznovTN May 10, 2022
0b00181
minor fix
ZheleznovTN May 12, 2022
6fbb7f3
Merge branch 'dev' into email-confirmation-flow
lmmrssa May 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes to detect users for sign up confirmation
neil-sweetcodepro committed May 6, 2022
commit f22f8503b4b31e61d0a963b6a5974ac02cd580cf
9 changes: 6 additions & 3 deletions api/src/controllers/userController.js
Original file line number Diff line number Diff line change
@@ -155,15 +155,18 @@ const registerUser = async (req, res) => {
})
}

const responseData = {}

if (isCognito) {
await registerCognito(username, password)
responseData.message = 'Code for sign up confirmation was sent to your email'
responseData.forSignUpConfirmation = true
} else {
await registerLocal(username, password)
responseData.message = 'The user has been registered'
}

res.status(201).send({
message: 'The user has been registered'
})
res.status(201).send(responseData)
} catch (err) {
res.status(409).json({ error: err.message })
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"aws-amplify": "^3.3.27",
"aws-amplify": "^4.3.21",
"axios": "^0.21.1",
"classnames": "^2.3.1",
"dayjs": "^1.10.7",
16 changes: 15 additions & 1 deletion src/actions/auth.js
Original file line number Diff line number Diff line change
@@ -65,7 +65,19 @@ export const login =
let authData = {};
let response;
if (isCognito) {
response = await Auth.signIn(name, password);
try {
// try to use formatted username
const username = name.replace(/@/g, "");
response = await Auth.signIn(username, password);
} catch (error) {
if (error.code === "UserNotConfirmedException") {
// TODO: add handling unconfirmed user
throw error;
}
// try non formatted email
response = await Auth.signIn(name, password);
}

const id = response?.attributes?.sub || "";
authData = {
id,
@@ -104,6 +116,8 @@ export const register =
// no auto login for cognito since it needs to confirm email with a code
if (!isCognito) {
await login({ name, password })(dispatch);
} else if (response.data.forSignUpConfirmation) {
// TODO: add handling for sign up confirmation
}

return Promise.resolve();