SecurityView.js 2.81 KB
Newer Older
1
import React, { Component, Fragment } from 'react';
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
2
import { formatMessage, FormattedMessage } from 'umi/locale';
3
import { List } from 'antd';
4
// import { getTimeDistance } from '@/utils/utils';
5 6

const passwordStrength = {
εΌ η§€ηŽ²'s avatar
εΌ η§€ηŽ² committed
7 8 9 10 11 12 13 14 15 16 17 18
  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">
19 20
      <FormattedMessage id="app.settings.security.weak" defaultMessage="Weak" />
      Weak
εΌ η§€ηŽ²'s avatar
εΌ η§€ηŽ² committed
21 22
    </font>
  ),
23 24
};

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

85 86 87 88 89 90 91 92
  render() {
    return (
      <Fragment>
        <List
          itemLayout="horizontal"
          dataSource={this.getData()}
          renderItem={item => (
            <List.Item actions={item.actions}>
jim's avatar
jim committed
93
              <List.Item.Meta title={item.title} description={item.description} />
94 95 96 97 98 99 100
            </List.Item>
          )}
        />
      </Fragment>
    );
  }
}
lijiehua's avatar
lijiehua committed
101

ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
102
export default SecurityView;