SecurityView.js 3.07 KB
Newer Older
陈帅's avatar
陈帅 committed
1
import React, { Component, Fragment } from 'react';
张秀玲's avatar
张秀玲 committed
2
import { injectIntl, FormattedMessage } from 'react-intl';
陈帅's avatar
陈帅 committed
3
import { List } from 'antd';
张秀玲's avatar
张秀玲 committed
4
// import { getTimeDistance } from '../../../utils/utils';
陈帅's avatar
陈帅 committed
5 6

const passwordStrength = {
张秀玲's avatar
张秀玲 committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
  strong: (
    <font className="strong">
      <FormattedMessage id="app.settings.security.strong" defaultMessage="Strong" />
    </font>
  ),
  medium: (
    <font className="medium">
      <FormattedMessage id="app.settings.security.medium" defaultMessage="Medium" />
    </font>
  ),
  weak: (
    <font className="weak">
      <FormattedMessage id="app.settings.security.weak" defaultMessage="Weak" />Weak
    </font>
  ),
陈帅's avatar
陈帅 committed
22 23
};

张秀玲's avatar
张秀玲 committed
24
class SecurityView extends Component {
陈帅's avatar
陈帅 committed
25
  getData = () => {
张秀玲's avatar
张秀玲 committed
26
    const { intl } = this.props;
陈帅's avatar
陈帅 committed
27 28
    return [
      {
张秀玲's avatar
张秀玲 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42
        title: intl.formatMessage({ id: 'app.settings.security.password' }, {}),
        description: (
          <Fragment>
            {' '}
            {intl.formatMessage({ id: 'app.settings.security.password-description' }, {})}{
              passwordStrength.strong
            }
          </Fragment>
        ),
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
43 44
      },
      {
张秀玲's avatar
张秀玲 committed
45 46 47 48 49 50 51 52 53 54
        title: intl.formatMessage({ id: 'app.settings.security.phone' }, {}),
        description: `${intl.formatMessage(
          { id: 'app.settings.security.phone-description' },
          {}
        )}:138****8293`,
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
55 56
      },
      {
张秀玲's avatar
张秀玲 committed
57 58 59 60 61 62 63
        title: intl.formatMessage({ id: 'app.settings.security.question' }, {}),
        description: intl.formatMessage({ id: 'app.settings.security.question-description' }, {}),
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.set" defaultMessage="Set" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
64 65
      },
      {
张秀玲's avatar
张秀玲 committed
66 67 68 69 70 71 72 73 74 75
        title: intl.formatMessage({ id: 'app.settings.security.email' }, {}),
        description: `${intl.formatMessage(
          { id: 'app.settings.security.email-description' },
          {}
        )}:ant***sign.com`,
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
76 77
      },
      {
张秀玲's avatar
张秀玲 committed
78 79 80 81 82 83 84
        title: intl.formatMessage({ id: 'app.settings.security.mfa' }, {}),
        description: intl.formatMessage({ id: 'app.settings.security.mfa-description' }, {}),
        actions: [
          <a>
            <FormattedMessage id="app.settings.security.bind" defaultMessage="Bind" />
          </a>,
        ],
陈帅's avatar
陈帅 committed
85 86 87
      },
    ];
  };
陈帅's avatar
陈帅 committed
88

陈帅's avatar
陈帅 committed
89 90 91 92 93 94 95 96
  render() {
    return (
      <Fragment>
        <List
          itemLayout="horizontal"
          dataSource={this.getData()}
          renderItem={item => (
            <List.Item actions={item.actions}>
jim's avatar
jim committed
97
              <List.Item.Meta title={item.title} description={item.description} />
陈帅's avatar
陈帅 committed
98 99 100 101 102 103 104
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
张秀玲's avatar
张秀玲 committed
105
export default injectIntl(SecurityView);