PageSourceSearch

https://www.imlanghome.com/assets/js/unit/login.js

js imlanghome.com collected 2026-10-05 02:54:42 UTC 1,608 bytes, 48 lines download raw bytes

1class ScriptLogin extends Script {
2  constructor(params) {
3    super(params)
4    this.msg = params.msg
5    this.$form = document.querySelector(`#${this.attrId} form`)
6  }
7  /** 初始化,支持异步 */
8  async init() {
9    // 已登录的情况先退出
10    if (window.app.info.user.is_login) window.app.utilts.logout()
11    // 表单提交事件
12    this.$form.onsubmit = event => {
13      // 取消默认事件
14      event.preventDefault()
15      this.check(event)
16      // 提交
17      this.submit()
18    }
19    // 某些情况下再调一次提交
20  }
21
22  check(event) {
23    const $username = document.getElementById('username')
24    const $password = document.getElementById('password')
25    const emailRexp = /[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+)*@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(\.[a-zA-Z]{2,})$/
26    if (!emailRexp.test($username.value)) {
27      new Message().warn(Utilts.ins().$t('email format does not match'))
28      return false
29    }
30    if ($password.value.length < 6) {
31      new Message().warn(Utilts.ins().$t('Password length should be 6-20'))
32      return false
33    }
34  }
35
36  /** 提交 */
37  submit() {
38    this.$form.classList.add('was-validated')
39    if (!this.$form.checkValidity()) return
40    else this.$form.classList.remove('was-validated')
41    this.$form.querySelector('[type=submit]').setAttribute('disabled', 'disabled')
42    setTimeout(() => {
43      this.$form.querySelector('[type=submit]').removeAttribute('disabled')
44    }, 3000)
45    const formData = new FormData(this.$form)
46    window.app.utilts.login({ username: formData.get('username'), password: formData.get('password') })
47  }
48}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.