diff --git a/src/images/email_example.jpg b/src/images/email_example.jpg new file mode 100644 index 0000000..74b3210 Binary files /dev/null and b/src/images/email_example.jpg differ diff --git a/src/infrastructure/widgets.css b/src/infrastructure/widgets.css index ed5d7b2..99d9f59 100644 --- a/src/infrastructure/widgets.css +++ b/src/infrastructure/widgets.css @@ -334,3 +334,7 @@ a.button { padding: 5px; } + +.li-image { + width: 100%; +} diff --git a/src/infrastructure/widgets.js b/src/infrastructure/widgets.js index 215d01b..8a61ebb 100644 --- a/src/infrastructure/widgets.js +++ b/src/infrastructure/widgets.js @@ -8,6 +8,7 @@ import copy from 'copy-to-clipboard'; import './global.css'; import './widgets.css'; +import emailExample from '../images/email_example.jpg'; import { get_json, API_VERSION_PARAM } from './functions'; import { EMAIL } from '../UserAction'; @@ -68,6 +69,7 @@ class LoginPopupSelf extends Component { super(props); this.state = { token_phrase: '', + already_copy: false, }; } @@ -86,6 +88,17 @@ class LoginPopupSelf extends Component { sha256_hex(token_phrase + 'hole' + new Date().toDateString(), 16) .then((token) => sha256_hex(token + 'hole', 16)) .then((token_hash) => copy('|' + token_hash + '|')); + + this.setState({already_copy: true}); + } + + copy_token_phrase(event) { + const { token_phrase } = this.state; + if (!token_phrase) { + alert('不可以为空'); + return; + } + copy(token_phrase); } use_token(event) { @@ -103,7 +116,7 @@ class LoginPopupSelf extends Component { } render() { - const { token_phrase } = this.state; + const { token_phrase, already_copy } = this.state; return (
@@ -115,22 +128,36 @@ class LoginPopupSelf extends Component {
  1. - 输入任意独特内容或 - this.setState({token_phrase: window.crypto.randomUUID()})}> - 使用随机值 + this.setState({token_phrase: window.crypto.randomUUID(), already_copy: false})}> + 生成 - ,以生成token。请务必保存好输入的内容,并避免泄漏。 -
  2. -
  3. - 点击此处 - 复制token的哈希,通过你的清华邮箱发送到 - {EMAIL}。不同设备在同一天输入相同内容即可,请勿重复发件。 + 或粘贴用来生成token的ID。
  4. -
  5. + {!!token_phrase && ( +
  6. + 点击此处 + 复制此ID用于在其他设备上登录,当日有效,注意妥善保管。 +
  7. + )} + {!!token_phrase && ( +
  8. + 点击此处 + 复制用来发送邮件的内容 +
  9. + )} + {!!already_copy ? ( +
  10. + 发送邮件到 + {EMAIL}。 + 不同设备请勿重复发件。 后台每15分钟查收一次邮件,等待一段时间后 点击此处 - 使用此token登陆。 -
  11. + 使用此token登录。示例: + + + ) : ( +
  12. ...
  13. + )}