PageSourceSearch

https://optimo.ch/assets/gray_matter/authentication/login-6bfe968b…7cf28238351a39dae91a2d8bfed8c0a77001c39c.js

js optimo.ch collected 2026-10-02 03:23:47 UTC 1,121 bytes, 35 lines download raw bytes

1// Copyright (c) 2021-2025 GrayBits LLC
2
3import axios from 'axios'
4import AuthenticationForm from 'gray_matter/authentication/authentication_form'
5
6export default class Login extends AuthenticationForm{
7  postSubmit(response){
8    if (response.data.show_authentication_code){
9      this.form.querySelector('.authentication_code').classList.remove('hidden');
10      this.errors.show({message: 'Enter both your password and the authentication code from your second factor device.'});
11    }
12  }
13  setup(){
14    let one_time = this.form.querySelector('.get_one_time_login_link');
15    if (one_time){
16      one_time.addEventListener('click', (e) => this.requestOneTimeLoginLink(e));
17    }
18  }
19
20  async requestOneTimeLoginLink(e){
21    let button = e.target.closest('button');
22    
23    try {
24      const response = await axios.post(this.form.dataset.oneTime, new FormData(this.form));
25      this.errors.show({message: 'We have sent you an email with a one-time login link.'});
26    } catch (error) {
27      this.errors.clear();
28      this.errors.show(error.response.data);
29    }
30  }
31
32  static formClass(){
33    return 'login';
34  }
35};

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.