File size: 2,871 Bytes
adc1e1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
Copyright (c) 2025 Tethys Plex

This file is part of Veloera.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// Telegram login fields
export const TELEGRAM_LOGIN_FIELDS = [
  'id',
  'first_name',
  'last_name',
  'username',
  'photo_url',
  'auth_date',
  'hash',
  'lang',
];

// Common form styles
export const FORM_STYLES = {
  container: {
    justifyContent: 'center',
    display: 'flex',
    marginTop: 120,
  },
  card: {
    width: 500,
  },
  linkContainer: {
    display: 'flex',
    justifyContent: 'space-between',
    marginTop: 20,
  },
  thirdPartyContainer: {
    display: 'flex',
    justifyContent: 'center',
    marginTop: 20,
  },
  telegramContainer: {
    display: 'flex',
    justifyContent: 'center',
    marginTop: 5,
  },
  turnstileContainer: {
    display: 'flex',
    justifyContent: 'center',
    marginTop: 20,
  },
  wechatModalContent: {
    display: 'flex',
    alignItem: 'center',
    flexDirection: 'column',
  },
  wechatModalText: {
    textAlign: 'center',
  },
};

// Common validation messages
export const VALIDATION_MESSAGES = {
  TURNSTILE_WAIT: '请稍后几秒重试,Turnstile 正在检查用户环境!',
  LOGIN_SUCCESS: '登录成功!',
  REGISTER_SUCCESS: '注册成功!',
  PASSWORD_TOO_SHORT: '密码长度不得小于 8 位!',
  PASSWORD_MISMATCH: '两次输入的密码不一致',
  MISSING_CREDENTIALS: '请输入用户名和密码!',
  VERIFICATION_CODE_SENT: '验证码发送成功,请检查你的邮箱!',
  DEFAULT_PASSWORD_WARNING: '您正在使用默认密码!',
  CHANGE_DEFAULT_PASSWORD: '请立刻修改默认密码!',
  SESSION_EXPIRED: '未登录或登录已过期,请重新登录',
};

// Helper functions
export const getAffCode = () => {
  let statusFromStorage = localStorage.getItem('status');
  if (statusFromStorage) {
    statusFromStorage = JSON.parse(statusFromStorage);
    if (statusFromStorage.aff_enabled === true) {
      let affCode = new URLSearchParams(window.location.search).get('aff');
      if (affCode) {
        localStorage.setItem('aff', affCode);
        return affCode;
      }
      return localStorage.getItem('aff');
    }
  }
  return null;
};

export const getStoredStatus = () => {
  let status = localStorage.getItem('status');
  return status ? JSON.parse(status) : {};
};