Skip to content

Commit 55def13

Browse files
maxceemRishiRajSahu
authored andcommitted
issue #2654 - verification email container with success/failure/expired messages
1 parent a776610 commit 55def13

File tree

13 files changed

+233
-14
lines changed

13 files changed

+233
-14
lines changed

src/components/CoderBot/CoderBot.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import './CoderBot.scss'
44
import CoderBroken from '../../assets/icons/coder-broken.svg'
5+
import CoderHappy from '../../assets/icons/coder-welcome.svg'
56

67

78

@@ -26,14 +27,17 @@ const getMessage = code => {
2627
}
2728
}
2829

29-
const CoderBot = ({code, message}) => {
30+
const CoderBot = ({code, message, heading, children}) => {
3031
return (
3132
<section className="content content-error">
3233
<div className="container">
3334
<div className="page-error">
34-
<h3>{ getHeading(code) }</h3>
35-
<p dangerouslySetInnerHTML={ {__html : message || getMessage(code) } } />
36-
<CoderBroken className="icon-coder-broken" />
35+
<h3>{ heading || getHeading(code) }</h3>
36+
<div className="content">
37+
<p dangerouslySetInnerHTML={ {__html : message || getMessage(code) } } />
38+
<div>{children}</div>
39+
</div>
40+
{code !== 200 ? <CoderBroken className="icon-coder-broken" /> : <CoderHappy className="icon-coder-broken" />}
3741
<span>{code !== 200 && code}</span>
3842
</div>
3943
</div>

src/components/CoderBot/CoderBot.scss

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
}
3434
}
3535
background-size: 307px 300px;
36-
a{
37-
color: $tc-dark-blue;
38-
&:hover {
39-
text-decoration: underline;
40-
}
41-
}
4236
h3{
4337
color: $tc-gray-70;
4438
@include roboto-medium;
@@ -56,9 +50,11 @@
5650
font-size: 30px;
5751
}
5852
}
53+
.content {
54+
min-height: 120px;
55+
}
5956
p{
6057
text-align: left;
61-
min-height: 120px;
6258
padding: 0 168px;
6359
@include roboto;
6460
font-size: $tc-label-lg;
@@ -71,6 +67,13 @@
7167
@media screen and (max-width: $screen-md - 1px) {
7268
padding: 0 28px;
7369
}
70+
71+
a{
72+
color: $tc-dark-blue;
73+
&:hover {
74+
text-decoration: underline;
75+
}
76+
}
7477
}
7578
span{
7679
position: absolute;

src/routes/settings/routes.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ import NotificationSettingsContainer from './routes/notifications/containers/Not
99
import SettingsToolBar from './components/SettingsToolBar'
1010
import SystemSettingsContainer from './routes/system/containers/SystemSettingsContainer'
1111
import ProfileSettingsContainer from './routes/profile/containers/ProfileSettingsContainer'
12+
import EmailVerificationFailure from './routes/email-verification/components/Failure'
13+
import EmailVerificationSuccessContainer from './routes/email-verification/containers/SuccessContainer'
1214

1315
export default [
14-
<Route key={'system'} path="/settings/account" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <SystemSettingsContainer />)} />,
15-
<Route key={'notifications'} path="/settings/notifications" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <NotificationSettingsContainer />)} />,
16-
<Route key={'profile'} path="/settings/profile" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <ProfileSettingsContainer />)} />
16+
<Route key="account" exact path="/settings/account" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <SystemSettingsContainer />)} />,
17+
<Route key="account/email-verification/success" exact path="/settings/account/email-verification/success/:handle/:token/:newEmail/:oldEmail/:jwtToken" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <EmailVerificationSuccessContainer />)} />,
18+
<Route key="account/email-verification/failure" exact path="/settings/account/email-verification/failure" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <EmailVerificationFailure />)} />,
19+
20+
<Route key="notifications" exact path="/settings/notifications" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <NotificationSettingsContainer />)} />,
21+
<Route key="profile" exact path="/settings/profile" render={renderApp(<TopBarContainer toolbar={SettingsToolBar} />, <ProfileSettingsContainer />)} />,
22+
1723
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Message to show when new email verification link is expired.
3+
*/
4+
import React from 'react'
5+
import { Link } from 'react-router-dom'
6+
import CoderBot from '../../../../../../components/CoderBot/CoderBot'
7+
8+
import './Expired.scss'
9+
10+
const Expired = () => (
11+
<CoderBot
12+
code={401}
13+
heading="Email Verification Failed"
14+
message="Sorry, this verification link is no longer valid due to one of the following reasons:"
15+
>
16+
<ul styleName="list">
17+
<li>It has already been verified.</li>
18+
<li>It has expired or has been cancelled, any pending email change that is cancelled is no longer subject to verification.</li>
19+
</ul>
20+
<div styleName="controls">
21+
<Link className="tc-btn tc-btn-primary" to="/settings/account">Back to My Account</Link>
22+
</div>
23+
</CoderBot>
24+
)
25+
26+
export default Expired
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@import '~tc-ui/src/styles/tc-includes';
2+
3+
.list {
4+
@include roboto;
5+
font-size: $tc-label-lg;
6+
color: $tc-gray-70;
7+
letter-spacing: 0px;
8+
line-height: 23px;
9+
padding: 0 168px;
10+
text-align: left;
11+
12+
@media screen and (max-width: 1000px - 1px) {
13+
padding: 0 100px;
14+
}
15+
16+
@media screen and (max-width: $screen-md - 1px) {
17+
padding: 0 28px;
18+
}
19+
20+
li {
21+
list-style: inside circle;
22+
}
23+
}
24+
25+
.controls {
26+
margin-top: 5 * $base-unit;
27+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Expired from './Expired'
2+
export default Expired
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Message to show when new email verification failed.
3+
*/
4+
import React from 'react'
5+
import { Link } from 'react-router-dom'
6+
import CoderBot from '../../../../../../components/CoderBot/CoderBot'
7+
8+
import './Failure.scss'
9+
10+
const Failure = () => (
11+
<CoderBot
12+
code={400}
13+
heading="Email Verification Failed"
14+
message="We could not verify your email. If you have any issues with your Topcoder account, please contact <a href='mailto:support@topcoder.com'>support@topcoder.com</a>."
15+
>
16+
<div styleName="controls">
17+
<Link className="tc-btn tc-btn-primary" to="/settings/account">Back to My Account</Link>
18+
</div>
19+
</CoderBot>
20+
)
21+
22+
export default Failure
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import '~tc-ui/src/styles/tc-includes';
2+
3+
.controls {
4+
margin-top: 5 * $base-unit;
5+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Failure from './Failure'
2+
export default Failure
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Message to show when new email verification was success.
3+
*/
4+
import React from 'react'
5+
import { Link } from 'react-router-dom'
6+
import CoderBot from '../../../../../../components/CoderBot/CoderBot'
7+
8+
import './Success.scss'
9+
10+
const Success = () => (
11+
<CoderBot
12+
code={200}
13+
heading="Email Verification Success"
14+
message="Congratulations! Your email verification has been completed."
15+
>
16+
<div styleName="controls">
17+
<Link className="tc-btn tc-btn-primary" to="/settings/account">Back to My Account</Link>
18+
</div>
19+
</CoderBot>
20+
)
21+
22+
export default Success

0 commit comments

Comments
 (0)