Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf5e02d

Browse files
ThomasKranitsassushilshinde
authored andcommittedMay 24, 2019
Fix flow for SSO users in settings page
1 parent 4f4af6d commit cf5e02d

File tree

1 file changed

+5
-11
lines changed
  • src/shared/components/Settings/Account/MyAccount

1 file changed

+5
-11
lines changed
 

‎src/shared/components/Settings/Account/MyAccount/index.jsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/* eslint-disable no-undef */
88
import React from 'react';
99
import PT from 'prop-types';
10-
import { omit } from 'lodash';
10+
import { omit, get } from 'lodash';
1111
import ConsentComponent from 'components/Settings/ConsentComponent';
1212
import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
1313
import Personalization from 'components/Settings/Preferences/Personalization';
@@ -57,7 +57,6 @@ export default class MyAccount extends ConsentComponent {
5757
reNewPassword: '',
5858
isMobileView: false,
5959
screenSM: 767,
60-
ssoUser: false,
6160
isSent: false,
6261
isOpen: false,
6362
};
@@ -175,12 +174,8 @@ export default class MyAccount extends ConsentComponent {
175174
}
176175

177176
onChangeEmail() {
178-
const { profile } = this.props;
179-
if (profile.withSSO !== null && profile.withSSO !== undefined && profile.withSSO) {
180-
this.setState({
181-
ssoUser: true,
182-
});
183-
} else {
177+
const { profileState } = this.props;
178+
if (get(profileState, 'credential.hasPassword')) {
184179
const newState = { ...this.state };
185180
newState.btnChangeEmailVisible = false;
186181
newState.btnVerifiEmailVisible = true;
@@ -383,7 +378,6 @@ export default class MyAccount extends ConsentComponent {
383378
showRePasswordTips,
384379
rePasswordValid,
385380
isValidEmail,
386-
ssoUser,
387381
isOpen,
388382
} = this.state;
389383

@@ -479,7 +473,7 @@ export default class MyAccount extends ConsentComponent {
479473
</div>
480474
</div>
481475
{
482-
ssoUser && (
476+
get(profileState, 'credential.hasPassword', false) === false && (
483477
<div styleName="error-message">
484478
Since you joined Topcoder using your &lt;SSO Service&gt; account,
485479
any email updates will need to be handled by logging in to
@@ -573,7 +567,7 @@ export default class MyAccount extends ConsentComponent {
573567
</div>
574568
</div>
575569
{
576-
ssoUser && (
570+
get(profileState, 'credential.hasPassword', false) === false && (
577571
<div styleName="error-message">
578572
Since you joined Topcoder using your &lt;SSO Service&gt; account,
579573
any email updates will need to be handled by logging in to

0 commit comments

Comments
 (0)
Please sign in to comment.