create-lupine 1.0.31 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +25 -0
  2. package/index.js +11 -9
  3. package/package.json +1 -1
  4. package/templates/common/.agents/skills/lupine-framework/SKILL.md +63 -0
  5. package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +98 -0
  6. package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +71 -0
  7. package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +100 -0
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +167 -0
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +54 -0
  10. package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +108 -0
  11. package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +119 -0
  12. package/templates/common/_env +2 -0
  13. package/templates/lupine-template-cv-starter/README.md +5 -0
  14. package/templates/lupine-template-cv-starter/web/src/index.tsx +1 -10
  15. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +1 -10
  16. package/templates/lupine-template-doc-starter/README.md +5 -0
  17. package/templates/lupine-template-doc-starter/web/src/index.tsx +1 -10
  18. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +1 -10
  19. package/templates/lupine-template-fullstack-starter/README.md +21 -0
  20. package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
  21. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
  22. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
  23. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
  24. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
  25. package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
  26. package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
  27. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
  28. package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
  29. package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
  30. package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
  31. package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
  32. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1041 -0
  33. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/lupine.json +10 -1
  34. package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
  35. package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
  36. package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
  37. package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
  38. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
  39. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
  40. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
  41. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
  42. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
  43. package/templates/lupine-template-fullstack-starter/web/assets/images/sample.png +0 -0
  44. package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
  45. package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
  46. package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
  47. package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
  48. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/package.json +1 -1
  49. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +16 -0
  50. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +22 -0
  51. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.html +22 -0
  52. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.tsx +64 -0
  53. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +52 -0
  54. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +15 -0
  55. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +75 -0
  56. package/templates/lupine-template-fullstack-starter/web/src/components/home-search-component.tsx +132 -0
  57. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +162 -0
  58. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +165 -0
  59. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +118 -0
  60. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +122 -0
  61. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +12 -0
  62. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +161 -0
  63. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +163 -0
  64. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +166 -0
  65. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +177 -0
  66. package/templates/lupine-template-fullstack-starter/web/src/components/story-card.tsx +96 -0
  67. package/templates/lupine-template-fullstack-starter/web/src/components/story-list.tsx +106 -0
  68. package/templates/lupine-template-fullstack-starter/web/src/components/story-props.ts +34 -0
  69. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +84 -0
  70. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +48 -0
  71. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +61 -0
  72. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +61 -0
  73. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +23 -0
  74. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +90 -0
  75. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/index.html +6 -0
  76. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +155 -0
  77. package/templates/lupine-template-fullstack-starter/web/src/models/client-env-keys.ts +5 -0
  78. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +15 -0
  79. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-cfg.tsx +140 -0
  80. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-edit.tsx +21 -0
  81. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-list.tsx +24 -0
  82. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-user.tsx +150 -0
  83. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +105 -0
  84. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +38 -0
  85. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +38 -0
  86. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +58 -0
  87. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +27 -0
  88. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +54 -0
  89. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +112 -0
  90. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +112 -0
  91. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +57 -0
  92. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +55 -0
  93. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +19 -0
  94. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +17 -0
  95. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
  96. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +3 -1
  97. package/templates/lupine-template-responsive-starter/README.md +7 -0
  98. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +1 -1
  99. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +2 -1
  100. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +2 -1
  101. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +8 -17
  102. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +15 -27
  103. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +2 -8
  104. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +26 -36
  105. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +16 -21
  106. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +9 -9
  107. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +3 -16
  108. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +3 -2
  109. package/templates/lupine-template-responsive-starter/web/src/index.tsx +2 -11
  110. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +1 -10
  111. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +3 -14
  112. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +3 -14
  113. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +7 -15
  114. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +7 -14
  115. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +3 -14
  116. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +2 -1
  117. package/templates/common/AI_CONTEXT.md +0 -1002
  118. package/templates/lupine-template-hello-world/api/package.json +0 -6
  119. package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
  120. package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
  121. package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
  122. package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
  123. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
  124. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
  125. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/assets/favicon.ico +0 -0
  126. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/app.css +0 -0
@@ -0,0 +1,161 @@
1
+ import { CssProps, PageProps, getRenderPageProps, WebConfig, refreshPage } from 'lupine.web';
2
+ import { DomUtils, NotificationColor, NotificationMessage, HtmlLoad } from 'lupine.web.components';
3
+ import { Footer } from './footer';
4
+
5
+ const fetchReg = async (body: any) => {
6
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/register', body);
7
+ return data.json;
8
+ };
9
+
10
+ export const RegisterPage = async (props: PageProps) => {
11
+ const css: CssProps = {
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ width: '100%',
15
+ minHeight: '100%',
16
+ overflowY: 'auto',
17
+ '.top-header': {
18
+ padding: '50px 0',
19
+ margin: 'auto',
20
+ fontSize: '200%',
21
+ },
22
+ '.top-content': {
23
+ flex: '1',
24
+ padding: '8px 16px',
25
+ margin: 'auto',
26
+ // '.login-button, .login-tip': {
27
+ // justifyContent: 'center',
28
+ // },
29
+ '.top-content-box': {
30
+ padding: '20px 40px',
31
+ boxShadow: 'var(--cover-box-shadow)',
32
+ },
33
+ '.login-button button': {
34
+ width: '100%',
35
+ fontSize: '150%',
36
+ height: '40px',
37
+ },
38
+ '.login-tip': {
39
+ color: 'gray',
40
+ fontSize: '90%',
41
+ },
42
+ '.login-tip a': {
43
+ padding: '0 10px',
44
+ },
45
+ '.label': {
46
+ width: '200px',
47
+ },
48
+ '.row-box': {
49
+ marginBottom: '16px',
50
+ },
51
+ },
52
+ '.top-footer': {
53
+ padding: '16px 16px 4px 16px',
54
+ margin: 'auto',
55
+ },
56
+ };
57
+
58
+ const onSubmit = async () => {
59
+ const username = DomUtils.getValue('.u-name')!;
60
+ const password = DomUtils.getValue('.u-pass')!;
61
+ if (!username || !password) {
62
+ NotificationMessage.sendMessage('请输入用户名和密码', NotificationColor.Error);
63
+ return;
64
+ }
65
+ // check username is email?
66
+ const re =
67
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
68
+ if (!re.test(username)) {
69
+ NotificationMessage.sendMessage('请输入一个正确的邮箱地址作为用户名', NotificationColor.Error);
70
+ return;
71
+ }
72
+ if (password.length < 6) {
73
+ NotificationMessage.sendMessage('密码长度至少为6位', NotificationColor.Error);
74
+ return;
75
+ }
76
+
77
+ const preferredName = DomUtils.getValue('.u-pname')!;
78
+ if (!preferredName) {
79
+ NotificationMessage.sendMessage('请输入网名', NotificationColor.Error);
80
+ return;
81
+ }
82
+
83
+ const isMale = DomUtils.getChecked('.u-male');
84
+ const isFemale = DomUtils.getChecked('.u-female');
85
+ if (!isMale && !isFemale) {
86
+ NotificationMessage.sendMessage('请选择性别', NotificationColor.Error);
87
+ return;
88
+ }
89
+
90
+ const body = {
91
+ u: username,
92
+ p: password,
93
+ preferredName,
94
+ sex: isMale ? 'male' : 'female',
95
+ };
96
+ const data = await fetchReg(body);
97
+ if (data.status === 'ok') {
98
+ NotificationMessage.sendMessage(data.message, NotificationColor.Success);
99
+ setTimeout(async () => {
100
+ await refreshPage('/login');
101
+ }, 1000);
102
+ } else {
103
+ NotificationMessage.sendMessage(data.message, NotificationColor.Error);
104
+ }
105
+ };
106
+ return (
107
+ <div css={css} class='admin-login'>
108
+ <div class='top-header'>
109
+ <div class='top-title'>注册账号</div>
110
+ </div>
111
+ <div class='top-content login-form-width'>
112
+ <div class='top-content-box'>
113
+ <div class='row-box'>
114
+ <div class='label'>用户名 (Email):</div>
115
+ <div>
116
+ <input class='input-base u-name' type='text' maxLength={50} />
117
+ </div>
118
+ </div>
119
+ <HtmlLoad
120
+ html={async () =>
121
+ (await WebConfig.get('verifyEmail', `1`)) ? (
122
+ <div class='row-box login-tip'>* 请仔细确认您的邮箱,您的邮箱将用于接收验证码。</div>
123
+ ) : null
124
+ }
125
+ ></HtmlLoad>
126
+ <div class='row-box'>
127
+ <div class='label'>密码:</div>
128
+ <div>
129
+ <input class='input-base u-pass' type='password' maxLength={50} />
130
+ </div>
131
+ </div>
132
+ <div class='row-box'>
133
+ <div class='label'>网名:</div>
134
+ <div>
135
+ <input class='input-base u-pname' type='text' maxLength={50} />
136
+ </div>
137
+ </div>
138
+ <div class='row-box'>
139
+ <div class='label'>性别:</div>
140
+ <div>
141
+ <input class='u-male' type='radio' name='sex' id='male' /> <label for='male'>男</label>
142
+ <input class='u-female ml-l' type='radio' name='sex' id='female' /> <label for='female'>女</label>
143
+ </div>
144
+ </div>
145
+ <div class='row-box login-button'>
146
+ <button onClick={() => onSubmit()} class='button-base'>
147
+ 注册
148
+ </button>
149
+ </div>
150
+ <div class='row-box login-tip'>
151
+ * 已经有一个账号了? <a href='/login'>登录</a>或者
152
+ <a href='/'>首页</a>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ <div class='top-footer'>
157
+ <Footer title="Copyright© 2025 <a href='/'>Home</a>. All Rights Reserved."></Footer>
158
+ </div>
159
+ </div>
160
+ );
161
+ };
@@ -0,0 +1,163 @@
1
+ import { CssProps, PageProps, getRenderPageProps, WebConfig } from 'lupine.web';
2
+ import { DomUtils, NotificationColor, NotificationMessage, HtmlLoad } from 'lupine.web.components';
3
+ import { Footer } from './footer';
4
+
5
+ const fetchReg = async (body: any) => {
6
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/register', body);
7
+ return data.json;
8
+ };
9
+
10
+ export const RegisterPage = async (props: PageProps) => {
11
+ const css: CssProps = {
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ width: '100%',
15
+ minHeight: '100%',
16
+ overflowY: 'auto',
17
+ '.top-header': {
18
+ padding: '50px 0',
19
+ margin: 'auto',
20
+ fontSize: '200%',
21
+ },
22
+ '.top-content': {
23
+ flex: '1',
24
+ padding: '8px 16px',
25
+ margin: 'auto',
26
+ // '.login-button, .login-tip': {
27
+ // justifyContent: 'center',
28
+ // },
29
+ '.top-content-box': {
30
+ padding: '20px 40px',
31
+ boxShadow: 'var(--cover-box-shadow)',
32
+ },
33
+ '.login-button button': {
34
+ width: '100%',
35
+ fontSize: '150%',
36
+ height: '40px',
37
+ },
38
+ '.login-tip': {
39
+ color: 'gray',
40
+ fontSize: '90%',
41
+ },
42
+ '.login-tip a': {
43
+ padding: '0 10px',
44
+ },
45
+ '.label': {
46
+ width: '200px',
47
+ },
48
+ '.row-box': {
49
+ marginBottom: '16px',
50
+ },
51
+ },
52
+ '.top-footer': {
53
+ padding: '16px 16px 4px 16px',
54
+ margin: 'auto',
55
+ },
56
+ };
57
+
58
+ const onSubmit = async () => {
59
+ const username = DomUtils.getValue('.u-name')!;
60
+ const password = DomUtils.getValue('.u-pass')!;
61
+ if (!username || !password) {
62
+ NotificationMessage.sendMessage('请输入用户名和密码', NotificationColor.Error);
63
+ return;
64
+ }
65
+ // check username is email?
66
+ const re =
67
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
68
+ if (!re.test(username)) {
69
+ NotificationMessage.sendMessage('请输入一个正确的邮箱地址作为用户名', NotificationColor.Error);
70
+ return;
71
+ }
72
+ if (password.length < 6) {
73
+ NotificationMessage.sendMessage('密码长度至少为6位', NotificationColor.Error);
74
+ return;
75
+ }
76
+
77
+ const preferredName = DomUtils.getValue('.u-pname')!;
78
+ if (!preferredName) {
79
+ NotificationMessage.sendMessage('请输入网名', NotificationColor.Error);
80
+ return;
81
+ }
82
+
83
+ const isMale = DomUtils.getChecked('.u-male');
84
+ const isFemale = DomUtils.getChecked('.u-female');
85
+ if (!isMale && !isFemale) {
86
+ NotificationMessage.sendMessage('请选择性别', NotificationColor.Error);
87
+ return;
88
+ }
89
+
90
+ const body = {
91
+ u: username,
92
+ p: password,
93
+ preferredName,
94
+ sex: isMale ? 'male' : 'female',
95
+ };
96
+ const data = await fetchReg(body);
97
+ if (data.status === 'ok') {
98
+ NotificationMessage.sendMessage(data.message, NotificationColor.Success);
99
+ setTimeout(() => {
100
+ window.location.href = '/login';
101
+ }, 1000);
102
+ } else {
103
+ NotificationMessage.sendMessage(data.message, NotificationColor.Error);
104
+ }
105
+ };
106
+ return (
107
+ <div css={css} class='admin-login'>
108
+ <div class='top-header'>
109
+ <div class='top-title'>Register</div>
110
+ </div>
111
+ <div class='top-content login-form-width'>
112
+ <div class='top-content-box'>
113
+ <div class='row-box'>
114
+ <div class='label'>Username (Email):</div>
115
+ <div>
116
+ <input class='input-base u-name' type='text' maxLength={50} />
117
+ </div>
118
+ </div>
119
+ <HtmlLoad
120
+ html={async () =>
121
+ (await WebConfig.get('verifyEmail', `1`)) ? (
122
+ <div class='row-box login-tip'>
123
+ * Confirm you email carefully and your email is used to receive authentication code.
124
+ </div>
125
+ ) : null
126
+ }
127
+ ></HtmlLoad>
128
+ <div class='row-box'>
129
+ <div class='label'>Password:</div>
130
+ <div>
131
+ <input class='input-base u-pass' type='password' maxLength={50} />
132
+ </div>
133
+ </div>
134
+ <div class='row-box'>
135
+ <div class='label'>Preferred Name:</div>
136
+ <div>
137
+ <input class='input-base u-pname' type='text' maxLength={50} />
138
+ </div>
139
+ </div>
140
+ <div class='row-box'>
141
+ <div class='label'>Gender:</div>
142
+ <div>
143
+ <input class='u-male' type='radio' name='sex' id='male' /> <label for='male'>Male</label>
144
+ <input class='u-female ml-l' type='radio' name='sex' id='female' /> <label for='female'>Female</label>
145
+ </div>
146
+ </div>
147
+ <div class='row-box login-button'>
148
+ <button onClick={() => onSubmit()} class='button-base'>
149
+ Register
150
+ </button>
151
+ </div>
152
+ <div class='row-box login-tip'>
153
+ * Already have an account? <a href='/login'>Login</a> or
154
+ <a href='/'>Home</a>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ <div class='top-footer'>
159
+ <Footer title="Copyright© 2025 <a href='/'>Home</a>. All Rights Reserved."></Footer>
160
+ </div>
161
+ </div>
162
+ );
163
+ };
@@ -0,0 +1,166 @@
1
+ import { CssProps, PageProps, getRenderPageProps } from 'lupine.web';
2
+ import { DomUtils, NotificationColor, NotificationMessage } from 'lupine.web.components';
3
+ import { Footer } from './footer';
4
+
5
+ const fetchCode = async (username: string) => {
6
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/reset-code', { u: username });
7
+ return data.json;
8
+ };
9
+
10
+ const fetchReset = async (username: string, password: string, authCode: string) => {
11
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/reset-pw', {
12
+ u: username,
13
+ p: password,
14
+ a: authCode,
15
+ });
16
+ return data.json;
17
+ };
18
+
19
+ export const ResetPasswordPage = async (props: PageProps) => {
20
+ const css: CssProps = {
21
+ display: 'flex',
22
+ flexDirection: 'column',
23
+ width: '100%',
24
+ minHeight: '100%',
25
+ overflowY: 'auto',
26
+ '.top-header': {
27
+ padding: '50px 0',
28
+ margin: 'auto',
29
+ fontSize: '200%',
30
+ },
31
+ '.top-content': {
32
+ flex: '1',
33
+ padding: '8px 16px',
34
+ margin: 'auto',
35
+ // '.login-button, .login-tip': {
36
+ // justifyContent: 'center',
37
+ // },
38
+ '.top-content-box': {
39
+ padding: '20px 40px',
40
+ boxShadow: 'var(--cover-box-shadow)',
41
+ },
42
+ '.login-button button': {
43
+ width: '100%',
44
+ fontSize: '150%',
45
+ height: '40px',
46
+ },
47
+ '.login-tip': {
48
+ color: 'gray',
49
+ fontSize: '90%',
50
+ },
51
+ '.login-tip a': {
52
+ paddingLeft: '10px',
53
+ },
54
+ '.label': {
55
+ width: '200px',
56
+ },
57
+ '.row-box': {
58
+ marginBottom: '16px',
59
+ },
60
+ },
61
+ '.top-footer': {
62
+ padding: '16px 16px 4px 16px',
63
+ margin: 'auto',
64
+ },
65
+ };
66
+
67
+ const onCode = async () => {
68
+ const codeButton = DomUtils.bySelector('.code-button') as HTMLButtonElement;
69
+ if (codeButton.classList.contains('disabled')) {
70
+ return;
71
+ }
72
+
73
+ const username = DomUtils.getValue('.u-name')!;
74
+ if (!username) {
75
+ NotificationMessage.sendMessage('请输入用户名', NotificationColor.Error);
76
+ return;
77
+ }
78
+ const auth = await fetchCode(username);
79
+ if (auth.status === 'ok') {
80
+ NotificationMessage.sendMessage('验证码已发送到您的邮箱,请复制并粘贴到此处', NotificationColor.Success);
81
+
82
+ codeButton.classList.add('disabled');
83
+ setTimeout(() => {
84
+ codeButton.classList.remove('disabled');
85
+ }, 60000);
86
+ } else {
87
+ NotificationMessage.sendMessage(auth.message, NotificationColor.Error);
88
+ }
89
+ };
90
+ const onReset = async () => {
91
+ const username = DomUtils.getValue('.u-name')!;
92
+ const password = DomUtils.getValue('.u-pass')!;
93
+ const password2 = DomUtils.getValue('.u-pass2')!;
94
+ const authCode = DomUtils.getValue('.u-code')!;
95
+ if (!username || !password || !password2 || !authCode) {
96
+ NotificationMessage.sendMessage('请输入用户名、密码和验证码', NotificationColor.Error);
97
+ return;
98
+ }
99
+ if (password !== password2) {
100
+ NotificationMessage.sendMessage('两次输入的密码不一致', NotificationColor.Error);
101
+ return;
102
+ }
103
+ if (password.length < 6) {
104
+ NotificationMessage.sendMessage('密码长度至少为6位', NotificationColor.Error);
105
+ return;
106
+ }
107
+ const auth = await fetchReset(username, password, authCode);
108
+ if (auth.status === 'ok') {
109
+ NotificationMessage.sendMessage('密码重置成功,请登录', NotificationColor.Success);
110
+ } else {
111
+ NotificationMessage.sendMessage(auth.message, NotificationColor.Error);
112
+ }
113
+ };
114
+
115
+ return (
116
+ <div css={css} class='admin-login'>
117
+ <div class='top-header'>
118
+ <div class='top-title'>重置密码</div>
119
+ </div>
120
+ <div class='top-content login-form-width'>
121
+ <div class='top-content-box'>
122
+ <div class='row-box'>
123
+ <div class='label'>用户名 (邮箱):</div>
124
+ <div>
125
+ <input class='input-base u-name' type='text' />
126
+ </div>
127
+ </div>
128
+ <div class='row-box code-button'>
129
+ <button onClick={() => onCode()} class='button-base'>
130
+ 发送验证码
131
+ </button>
132
+ </div>
133
+ <div class='row-box'>
134
+ <div class='label'>验证码:</div>
135
+ <div>
136
+ <input class='input-base u-code' type='text' />
137
+ </div>
138
+ </div>
139
+ <div class='row-box'>
140
+ <div class='label'>新密码:</div>
141
+ <div>
142
+ <input class='input-base u-pass' type='password' />
143
+ </div>
144
+ </div>
145
+ <div class='row-box'>
146
+ <div class='label'>确认密码:</div>
147
+ <div>
148
+ <input class='input-base u-pass2' type='password' />
149
+ </div>
150
+ </div>
151
+ <div class='row-box login-button'>
152
+ <button onClick={() => onReset()} class='button-base'>
153
+ 重置密码
154
+ </button>
155
+ </div>
156
+ <div class='row-box login-tip'>
157
+ * 用密码登录?<a href='/login'>去登录</a>或者<a href='/'>首页</a>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ <div class='top-footer'>
162
+ <Footer title="Copyright© 2025 <a href='/'>Home</a>. All Rights Reserved."></Footer>
163
+ </div>
164
+ </div>
165
+ );
166
+ };
@@ -0,0 +1,177 @@
1
+ import { createSignal, CssProps, getRenderPageProps, PageProps } from 'lupine.web';
2
+ import { DomUtils, NotificationColor, NotificationMessage } from 'lupine.web.components';
3
+ import { Footer } from './footer';
4
+
5
+ const fetchCode = async (username: string) => {
6
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/reset-code', { u: username });
7
+ return data.json;
8
+ };
9
+
10
+ const fetchReset = async (username: string, password: string, authCode: string) => {
11
+ const data = await getRenderPageProps().renderPageFunctions.fetchData('/api/reset-pw', {
12
+ u: username,
13
+ p: password,
14
+ a: authCode,
15
+ });
16
+ return data.json;
17
+ };
18
+
19
+ export const ResetPasswordPage = async (props: PageProps) => {
20
+ const css: CssProps = {
21
+ display: 'flex',
22
+ flexDirection: 'column',
23
+ width: '100%',
24
+ minHeight: '100%',
25
+ overflowY: 'auto',
26
+ '.top-header': {
27
+ padding: '50px 0',
28
+ margin: 'auto',
29
+ fontSize: '200%',
30
+ },
31
+ '.top-content': {
32
+ flex: '1',
33
+ padding: '8px 16px',
34
+ margin: 'auto',
35
+ // '.login-button, .login-tip': {
36
+ // justifyContent: 'center',
37
+ // },
38
+ '.top-content-box': {
39
+ padding: '20px 40px',
40
+ boxShadow: 'var(--cover-box-shadow)',
41
+ },
42
+ '.login-button button': {
43
+ width: '100%',
44
+ fontSize: '150%',
45
+ height: '40px',
46
+ },
47
+ '.login-tip': {
48
+ color: 'gray',
49
+ fontSize: '90%',
50
+ },
51
+ '.login-tip a': {
52
+ paddingLeft: '10px',
53
+ },
54
+ '.label': {
55
+ width: '200px',
56
+ },
57
+ '.row-box': {
58
+ marginBottom: '16px',
59
+ },
60
+ },
61
+ '.top-footer': {
62
+ padding: '16px 16px 4px 16px',
63
+ margin: 'auto',
64
+ },
65
+ };
66
+
67
+ const onCode = async () => {
68
+ const codeButton = DomUtils.bySelector('.code-button') as HTMLButtonElement;
69
+ if (codeButton.classList.contains('disabled')) {
70
+ return;
71
+ }
72
+
73
+ const username = DomUtils.getValue('.u-name')!;
74
+ if (!username) {
75
+ NotificationMessage.sendMessage('Please input username (Email)', NotificationColor.Error);
76
+ return;
77
+ }
78
+
79
+ const auth = await fetchCode(username);
80
+ if (auth.status === 'ok') {
81
+ NotificationMessage.sendMessage(
82
+ 'Authentication code is sent to your email, please copy it and paste it here.',
83
+ NotificationColor.Success
84
+ );
85
+
86
+ codeButton.classList.add('disabled');
87
+ setTimeout(() => {
88
+ codeButton.classList.remove('disabled');
89
+ }, 60000);
90
+ } else {
91
+ NotificationMessage.sendMessage(auth.message, NotificationColor.Error);
92
+ }
93
+ };
94
+ const onReset = async () => {
95
+ const username = DomUtils.getValue('.u-name')!;
96
+ const password = DomUtils.getValue('.u-pass')!;
97
+ const password2 = DomUtils.getValue('.u-pass2')!;
98
+ const authCode = DomUtils.getValue('.u-code')!;
99
+ if (!username || !password || !password2 || !authCode) {
100
+ NotificationMessage.sendMessage(
101
+ 'Please input username, password and authentication code',
102
+ NotificationColor.Error
103
+ );
104
+ return;
105
+ }
106
+ if (password !== password2) {
107
+ NotificationMessage.sendMessage('The two passwords do not match', NotificationColor.Error);
108
+ return;
109
+ }
110
+ if (password.length < 6) {
111
+ NotificationMessage.sendMessage('Password length must be at least 6 characters', NotificationColor.Error);
112
+ return;
113
+ }
114
+ const auth = await fetchReset(username, password, authCode);
115
+ if (auth.status === 'ok') {
116
+ NotificationMessage.sendMessage('Your password is reset, please go to Login page', NotificationColor.Success);
117
+ } else {
118
+ NotificationMessage.sendMessage(auth.message, NotificationColor.Error);
119
+ }
120
+ };
121
+
122
+ return (
123
+ <div css={css} class='admin-login'>
124
+ <div class='top-header'>
125
+ <div class='top-title'>Reset Password</div>
126
+ </div>
127
+ <div class='top-content login-form-width'>
128
+ <div class='top-content-box'>
129
+ <div class='row-box'>
130
+ <div class='label'>Username (Email):</div>
131
+ <div>
132
+ <input class='input-base u-name' type='text' />
133
+ </div>
134
+ </div>
135
+ <div class='row-box'>
136
+ <button onClick={() => onCode()} class='button-base code-button'>
137
+ Send Authentication Code
138
+ </button>
139
+ </div>
140
+ <div class='row-box'>
141
+ <div class='label'>Authentication Code:</div>
142
+ <div>
143
+ <input class='input-base u-code' type='text' />
144
+ </div>
145
+ </div>
146
+ <div class='row-box'>
147
+ <div class='label'>New Password:</div>
148
+ <div>
149
+ <input class='input-base u-pass' type='password' />
150
+ </div>
151
+ </div>
152
+ <div class='row-box'>
153
+ <div class='label'>Confirm Password:</div>
154
+ <div>
155
+ <input class='input-base u-pass2' type='password' />
156
+ </div>
157
+ </div>
158
+ <div class='row-box login-button'>
159
+ <button onClick={() => onReset()} class='button-base'>
160
+ Reset Password
161
+ </button>
162
+ </div>
163
+ <div class='row-box login-tip'>
164
+ * Login with your password?
165
+ <a href='/login' class='pr-m'>
166
+ Go to Login
167
+ </a>{' '}
168
+ or <a href='/'>Home</a>
169
+ </div>
170
+ </div>
171
+ </div>
172
+ <div class='top-footer'>
173
+ <Footer title="Copyright© 2025 <a href='/'>Home</a>. All Rights Reserved."></Footer>
174
+ </div>
175
+ </div>
176
+ );
177
+ };