|
7 | 7 | /* eslint-disable no-undef */
|
8 | 8 | import React from 'react';
|
9 | 9 | import PT from 'prop-types';
|
10 |
| -import { omit } from 'lodash'; |
| 10 | +import { omit, get } from 'lodash'; |
11 | 11 | import ConsentComponent from 'components/Settings/ConsentComponent';
|
12 | 12 | import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
|
13 | 13 | import Personalization from 'components/Settings/Preferences/Personalization';
|
@@ -57,7 +57,6 @@ export default class MyAccount extends ConsentComponent {
|
57 | 57 | reNewPassword: '',
|
58 | 58 | isMobileView: false,
|
59 | 59 | screenSM: 767,
|
60 |
| - ssoUser: false, |
61 | 60 | isSent: false,
|
62 | 61 | isOpen: false,
|
63 | 62 | };
|
@@ -175,12 +174,8 @@ export default class MyAccount extends ConsentComponent {
|
175 | 174 | }
|
176 | 175 |
|
177 | 176 | 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')) { |
184 | 179 | const newState = { ...this.state };
|
185 | 180 | newState.btnChangeEmailVisible = false;
|
186 | 181 | newState.btnVerifiEmailVisible = true;
|
@@ -383,7 +378,6 @@ export default class MyAccount extends ConsentComponent {
|
383 | 378 | showRePasswordTips,
|
384 | 379 | rePasswordValid,
|
385 | 380 | isValidEmail,
|
386 |
| - ssoUser, |
387 | 381 | isOpen,
|
388 | 382 | } = this.state;
|
389 | 383 |
|
@@ -479,7 +473,7 @@ export default class MyAccount extends ConsentComponent {
|
479 | 473 | </div>
|
480 | 474 | </div>
|
481 | 475 | {
|
482 |
| - ssoUser && ( |
| 476 | + get(profileState, 'credential.hasPassword', false) === false && ( |
483 | 477 | <div styleName="error-message">
|
484 | 478 | Since you joined Topcoder using your <SSO Service> account,
|
485 | 479 | any email updates will need to be handled by logging in to
|
@@ -573,7 +567,7 @@ export default class MyAccount extends ConsentComponent {
|
573 | 567 | </div>
|
574 | 568 | </div>
|
575 | 569 | {
|
576 |
| - ssoUser && ( |
| 570 | + get(profileState, 'credential.hasPassword', false) === false && ( |
577 | 571 | <div styleName="error-message">
|
578 | 572 | Since you joined Topcoder using your <SSO Service> account,
|
579 | 573 | any email updates will need to be handled by logging in to
|
|
0 commit comments