ts-glitter 20.9.4 → 20.9.6
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.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/cms-plugin/pos-config-setting.js +22 -16
- package/lowcode/cms-plugin/pos-config-setting.ts +25 -20
- package/lowcode/cms-plugin/pos-pages/connection-mode.js +1 -0
- package/lowcode/cms-plugin/pos-pages/connection-mode.ts +1 -0
- package/lowcode/cms-plugin/pos-pages/payment-function.js +2 -0
- package/lowcode/cms-plugin/pos-pages/payment-function.ts +2 -0
- package/lowcode/cms-plugin/shopping-finance-setting.js +42 -8
- package/lowcode/cms-plugin/shopping-finance-setting.ts +52 -9
- package/lowcode/glitter-base/global/payment-config.js +2 -2
- package/lowcode/glitter-base/global/payment-config.ts +10 -2
- package/lowcode/public-components/user-manager/um-login.js +309 -228
- package/lowcode/public-components/user-manager/um-login.ts +390 -306
- package/package.json +1 -1
- package/src/api-public/models/glitter-finance.js.map +1 -1
- package/src/api-public/models/glitter-finance.ts +1 -0
- package/src/services/private_config.js +5 -0
- package/src/services/private_config.js.map +1 -1
- package/src/services/private_config.ts +6 -0
|
@@ -13,7 +13,7 @@ import { Language } from '../../glitter-base/global/language.js';
|
|
|
13
13
|
import { Tool } from '../../modules/tool.js';
|
|
14
14
|
import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
15
15
|
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
16
|
-
import { FormCheck } from
|
|
16
|
+
import { FormCheck } from '../../cms-plugin/module/form-check.js';
|
|
17
17
|
import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
18
18
|
const html = String.raw;
|
|
19
19
|
const css = String.raw;
|
|
@@ -48,13 +48,18 @@ export class UMLogin {
|
|
|
48
48
|
return UmClass.spinner();
|
|
49
49
|
}
|
|
50
50
|
if (vm.viewType === 'send_forget_pwd_email') {
|
|
51
|
-
return html
|
|
51
|
+
return html ` <section class="${gClass('container')}">
|
|
52
52
|
<div class="${gClass('box')}">
|
|
53
53
|
<div class="${gClass('login-title')}">${Language.text('forgot_password')}</div>
|
|
54
54
|
<div class="w-100 d-flex flex-column gap-3">
|
|
55
55
|
<div>
|
|
56
56
|
<label class="${gClass('label')}">${Language.text('email')}</label>
|
|
57
|
-
<input
|
|
57
|
+
<input
|
|
58
|
+
class="bgw-input"
|
|
59
|
+
type="text"
|
|
60
|
+
id="vm-email"
|
|
61
|
+
placeholder="${Language.text('email_placeholder')}"
|
|
62
|
+
/>
|
|
58
63
|
</div>
|
|
59
64
|
<div
|
|
60
65
|
class="${gClass('button')} my-2"
|
|
@@ -70,13 +75,18 @@ export class UMLogin {
|
|
|
70
75
|
</section>`;
|
|
71
76
|
}
|
|
72
77
|
if (vm.viewType === 'validation_code') {
|
|
73
|
-
return html
|
|
78
|
+
return html ` <section class="${gClass('container')}">
|
|
74
79
|
<div class="${gClass('box')}">
|
|
75
80
|
<div class="${gClass('login-title')}">${Language.text('enter_verification_code')}</div>
|
|
76
81
|
<div class="w-100 d-flex flex-column gap-3">
|
|
77
82
|
<div>
|
|
78
83
|
<label class="${gClass('label')}">${Language.text('verification_code')}</label>
|
|
79
|
-
<input
|
|
84
|
+
<input
|
|
85
|
+
class="bgw-input"
|
|
86
|
+
type="text"
|
|
87
|
+
id="vm-code"
|
|
88
|
+
placeholder="${Language.text('please_enter_verification_code')}"
|
|
89
|
+
/>
|
|
80
90
|
</div>
|
|
81
91
|
${this.sendCodeAgain(gvc, vm.prefix, () => {
|
|
82
92
|
this.sendResetEmail(widget, vm);
|
|
@@ -95,17 +105,27 @@ export class UMLogin {
|
|
|
95
105
|
</section>`;
|
|
96
106
|
}
|
|
97
107
|
if (vm.viewType === 'reset_password') {
|
|
98
|
-
return html
|
|
108
|
+
return html ` <section class="${gClass('container')}">
|
|
99
109
|
<div class="${gClass('box')}">
|
|
100
110
|
<div class="${gClass('login-title')}">${Language.text('reset_password')}</div>
|
|
101
111
|
<div class="w-100 d-flex flex-column gap-3">
|
|
102
112
|
<div>
|
|
103
113
|
<label class="${gClass('label')}">${Language.text('new_password')}</label>
|
|
104
|
-
<input
|
|
114
|
+
<input
|
|
115
|
+
class="bgw-input"
|
|
116
|
+
type="password"
|
|
117
|
+
id="vm-new-password"
|
|
118
|
+
placeholder="${Language.text('new_password_placeholder')}"
|
|
119
|
+
/>
|
|
105
120
|
</div>
|
|
106
121
|
<div>
|
|
107
122
|
<label class="${gClass('label')}">${Language.text('confirm_password')}</label>
|
|
108
|
-
<input
|
|
123
|
+
<input
|
|
124
|
+
class="bgw-input"
|
|
125
|
+
type="password"
|
|
126
|
+
id="vm-confirm-password"
|
|
127
|
+
placeholder="${Language.text('please_enter_password_again')}"
|
|
128
|
+
/>
|
|
109
129
|
</div>
|
|
110
130
|
<div
|
|
111
131
|
class="${gClass('button')} my-2"
|
|
@@ -121,7 +141,7 @@ export class UMLogin {
|
|
|
121
141
|
</section>`;
|
|
122
142
|
}
|
|
123
143
|
if (vm.viewType === 'register') {
|
|
124
|
-
return html
|
|
144
|
+
return html ` <section class="${gClass('container')}">
|
|
125
145
|
<div class="${gClass('box')}">
|
|
126
146
|
<div class="${gClass('login-title')}">${Language.text('member_register')}</div>
|
|
127
147
|
<div class="w-100 d-flex flex-column gap-3">
|
|
@@ -129,17 +149,21 @@ export class UMLogin {
|
|
|
129
149
|
.map((item) => {
|
|
130
150
|
if (item.hidden)
|
|
131
151
|
return '';
|
|
132
|
-
const title = ['name', 'email', 'phone', 'birth'].includes(item.key)
|
|
152
|
+
const title = ['name', 'email', 'phone', 'birth'].includes(item.key)
|
|
153
|
+
? Language.text(`form_${item.key}`)
|
|
154
|
+
: item.title;
|
|
133
155
|
const placeholder = Language.text(`please_enter_${item.key}`) || item.form_config.place_holder || '';
|
|
134
|
-
const cell = html
|
|
156
|
+
const cell = html ` <div class="position-relative">
|
|
135
157
|
<label class="${gClass('label')}">${title}</label>
|
|
136
158
|
<input
|
|
137
159
|
class="bgw-input"
|
|
138
160
|
type="${item.form_config.type}"
|
|
139
161
|
id="reg-${item.key}"
|
|
140
|
-
${
|
|
162
|
+
${item.form_config.type === 'date'
|
|
163
|
+
? ``
|
|
164
|
+
: ` placeholder="${placeholder}"
|
|
141
165
|
data-placeholder="${placeholder}"`}
|
|
142
|
-
onchange="${gvc.event(
|
|
166
|
+
onchange="${gvc.event(e => {
|
|
143
167
|
if (CheckInput.isEmpty(e.value)) {
|
|
144
168
|
e.style.color = 'rgba(0,0,0,0)';
|
|
145
169
|
e.dataset.placeholder = placeholder;
|
|
@@ -153,21 +177,31 @@ export class UMLogin {
|
|
|
153
177
|
</div>`;
|
|
154
178
|
if (item.key === 'email' && vm.loginConfig.email_verify) {
|
|
155
179
|
return html `${cell}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
180
|
+
<div>
|
|
181
|
+
<label class="${gClass('label')}">${Language.text('email_verification_code')}</label>
|
|
182
|
+
<input
|
|
183
|
+
class="bgw-input"
|
|
184
|
+
type="text"
|
|
185
|
+
id="reg-${item.key}-verify"
|
|
186
|
+
placeholder="${Language.text('please_enter_verification_code')}"
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
${this.sendCodeAgain(gvc, vm.prefix, () => {
|
|
161
190
|
this.sendVerifyEmailCode(widget, `reg-${item.key}`);
|
|
162
191
|
})}`;
|
|
163
192
|
}
|
|
164
193
|
if (item.key === 'phone' && vm.loginConfig.phone_verify) {
|
|
165
194
|
return html `${cell}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
195
|
+
<div>
|
|
196
|
+
<label class="${gClass('label')}">${Language.text('sms_verification_code')}</label>
|
|
197
|
+
<input
|
|
198
|
+
class="bgw-input"
|
|
199
|
+
type="text"
|
|
200
|
+
id="reg-${item.key}-verify"
|
|
201
|
+
placeholder="${Language.text('please_enter_verification_code')}"
|
|
202
|
+
/>
|
|
203
|
+
</div>
|
|
204
|
+
${this.sendCodeAgain(gvc, vm.prefix, () => {
|
|
171
205
|
this.sendVerifyPhoneCode(widget, `reg-${item.key}`);
|
|
172
206
|
})}`;
|
|
173
207
|
}
|
|
@@ -176,11 +210,21 @@ export class UMLogin {
|
|
|
176
210
|
.join('')}
|
|
177
211
|
<div>
|
|
178
212
|
<label class="${gClass('label')}">${Language.text('password')}</label>
|
|
179
|
-
<input
|
|
213
|
+
<input
|
|
214
|
+
class="bgw-input"
|
|
215
|
+
type="password"
|
|
216
|
+
id="vm-password"
|
|
217
|
+
placeholder="${Language.text('please_enter_password')}"
|
|
218
|
+
/>
|
|
180
219
|
</div>
|
|
181
220
|
<div>
|
|
182
221
|
<label class="${gClass('label')}">${Language.text('confirm_password')}</label>
|
|
183
|
-
<input
|
|
222
|
+
<input
|
|
223
|
+
class="bgw-input"
|
|
224
|
+
type="password"
|
|
225
|
+
id="vm-confirm-password"
|
|
226
|
+
placeholder="${Language.text('please_enter_password_again')}"
|
|
227
|
+
/>
|
|
184
228
|
</div>
|
|
185
229
|
<div
|
|
186
230
|
class="${gClass('button')} my-2"
|
|
@@ -194,41 +238,55 @@ export class UMLogin {
|
|
|
194
238
|
<div class="d-flex flex-column gap-2 text-center mt-1">
|
|
195
239
|
<div class="${gClass('font-16')}">
|
|
196
240
|
${Language.text('member_exists_prompt')}<span
|
|
197
|
-
|
|
198
|
-
|
|
241
|
+
class="${gClass('blue-note')}"
|
|
242
|
+
onclick="${gvc.event(() => {
|
|
199
243
|
this.viewCallback(vm, '');
|
|
200
244
|
})}"
|
|
201
|
-
|
|
202
|
-
|
|
245
|
+
>${Language.text('login')}</span
|
|
246
|
+
>
|
|
203
247
|
</div>
|
|
204
248
|
<div class="${gClass('font-14')}">
|
|
205
|
-
${Language.text('registration_terms_agreement')}<a class="${gClass('blue-note')}" href="/privacy"
|
|
249
|
+
${Language.text('registration_terms_agreement')}<a class="${gClass('blue-note')}" href="/privacy"
|
|
250
|
+
>${Language.text('terms_of_service')}</a
|
|
251
|
+
>${Language.text('and')}<a class="${gClass('blue-note')}" href="/term"
|
|
252
|
+
>${Language.text('privacy_policy')}</a
|
|
253
|
+
>
|
|
206
254
|
</div>
|
|
207
255
|
</div>
|
|
208
256
|
</div>
|
|
209
257
|
</div>
|
|
210
258
|
</section>`;
|
|
211
259
|
}
|
|
212
|
-
return html
|
|
260
|
+
return html ` <section class="${gClass('container')}">
|
|
213
261
|
<div class="${gClass('box')}">
|
|
214
262
|
<div class="${gClass('login-title')}">${Language.text('member_login')}</div>
|
|
215
263
|
<div class="w-100 d-flex flex-column gap-3">
|
|
216
264
|
<div>
|
|
217
265
|
<label class="${gClass('label')}">${Language.text('email_phone')}</label>
|
|
218
|
-
<input
|
|
266
|
+
<input
|
|
267
|
+
class="bgw-input"
|
|
268
|
+
type="text"
|
|
269
|
+
id="vm-account"
|
|
270
|
+
placeholder="${Language.text('email_phone_placeholder')}"
|
|
271
|
+
/>
|
|
219
272
|
</div>
|
|
220
273
|
<div>
|
|
221
274
|
<label class="${gClass('label')}">${Language.text('password')}</label>
|
|
222
|
-
<input
|
|
275
|
+
<input
|
|
276
|
+
class="bgw-input"
|
|
277
|
+
type="password"
|
|
278
|
+
id="vm-password"
|
|
279
|
+
placeholder="${Language.text('please_enter_password')}"
|
|
280
|
+
/>
|
|
223
281
|
</div>
|
|
224
282
|
<div class="text-end">
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
283
|
+
<span
|
|
284
|
+
class="${gClass('blue-note')}"
|
|
285
|
+
onclick="${gvc.event(() => {
|
|
228
286
|
vm.viewType = 'send_forget_pwd_email';
|
|
229
287
|
})}"
|
|
230
|
-
|
|
231
|
-
|
|
288
|
+
>${Language.text('forgot_password')}</span
|
|
289
|
+
>
|
|
232
290
|
</div>
|
|
233
291
|
<div
|
|
234
292
|
class="${gClass('button')} my-2"
|
|
@@ -242,19 +300,19 @@ export class UMLogin {
|
|
|
242
300
|
<div class="d-flex flex-column gap-2 text-center mt-1">
|
|
243
301
|
<div class="${gClass('font-16')}">
|
|
244
302
|
${Language.text('member_not_exists_prompt')}<span
|
|
245
|
-
|
|
246
|
-
|
|
303
|
+
class="${gClass('blue-note')}"
|
|
304
|
+
onclick="${gvc.event(() => {
|
|
247
305
|
this.viewCallback(vm, 'register');
|
|
248
306
|
})}"
|
|
249
|
-
|
|
250
|
-
|
|
307
|
+
>${Language.text('register')}</span
|
|
308
|
+
>
|
|
251
309
|
</div>
|
|
252
310
|
<div class="${gClass('font-14')}">
|
|
253
|
-
${Language.text('login_terms_agreement')}<a class="${gClass('blue-note')}" href="/privacy"
|
|
254
|
-
|
|
255
|
-
href="/term"
|
|
256
|
-
|
|
257
|
-
|
|
311
|
+
${Language.text('login_terms_agreement')}<a class="${gClass('blue-note')}" href="/privacy"
|
|
312
|
+
>${Language.text('terms_of_service')}</a
|
|
313
|
+
>${Language.text('and')}<a class="${gClass('blue-note')}" href="/term"
|
|
314
|
+
>${Language.text('privacy_policy')}</a
|
|
315
|
+
>
|
|
258
316
|
</div>
|
|
259
317
|
</div>
|
|
260
318
|
</div>
|
|
@@ -271,7 +329,7 @@ export class UMLogin {
|
|
|
271
329
|
if (loadings.view) {
|
|
272
330
|
Promise.all([
|
|
273
331
|
new Promise((resolve, reject) => {
|
|
274
|
-
ApiUser.getPublicConfig('login_config', 'manager').then(
|
|
332
|
+
ApiUser.getPublicConfig('login_config', 'manager').then(dd => {
|
|
275
333
|
if (dd.result && dd.response.value) {
|
|
276
334
|
resolve(dd.response.value);
|
|
277
335
|
}
|
|
@@ -281,7 +339,7 @@ export class UMLogin {
|
|
|
281
339
|
});
|
|
282
340
|
}),
|
|
283
341
|
new Promise((resolve, reject) => {
|
|
284
|
-
ApiUser.getPublicConfig('custom_form_register', 'manager').then(
|
|
342
|
+
ApiUser.getPublicConfig('custom_form_register', 'manager').then(dd => {
|
|
285
343
|
try {
|
|
286
344
|
resolve(dd.response.value.list || []);
|
|
287
345
|
}
|
|
@@ -290,7 +348,7 @@ export class UMLogin {
|
|
|
290
348
|
}
|
|
291
349
|
});
|
|
292
350
|
}),
|
|
293
|
-
]).then(
|
|
351
|
+
]).then(dataArray => {
|
|
294
352
|
vm.loginConfig = dataArray[0];
|
|
295
353
|
vm.registerConfig = FormCheck.initialRegisterForm(dataArray[1]);
|
|
296
354
|
setTimeout(() => {
|
|
@@ -305,96 +363,109 @@ export class UMLogin {
|
|
|
305
363
|
static addStyle(gvc, prefix) {
|
|
306
364
|
const isPhone = document.body.clientWidth < 768;
|
|
307
365
|
gvc.addStyle(css `
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
366
|
+
.${prefix}-container {
|
|
367
|
+
box-sizing: border-box;
|
|
368
|
+
display: flex;
|
|
369
|
+
align-items: center;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
padding-top: ${isPhone ? 0 : '100px'};
|
|
372
|
+
padding-bottom: ${isPhone ? '0px' : '230px'};
|
|
373
|
+
overflow: hidden;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.${prefix}-box {
|
|
377
|
+
border-radius: ${isPhone ? '0px' : '30px'};
|
|
378
|
+
background: #fff;
|
|
379
|
+
${isPhone ? '' : 'box-shadow: 5px 5px 20px 0px rgba(0, 0, 0, 0.15)'};
|
|
380
|
+
display: flex;
|
|
381
|
+
width: 576px;
|
|
382
|
+
padding: ${isPhone ? '56px 16px' : '56px'};
|
|
383
|
+
flex-direction: column;
|
|
384
|
+
justify-content: center;
|
|
385
|
+
align-items: center;
|
|
386
|
+
gap: 32px;
|
|
387
|
+
overflow: hidden;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.${prefix}-login-title {
|
|
391
|
+
color: #393939;
|
|
392
|
+
text-align: center;
|
|
393
|
+
font-size: 32px;
|
|
394
|
+
font-style: normal;
|
|
395
|
+
font-weight: 700;
|
|
396
|
+
line-height: 140%;
|
|
397
|
+
margin-bottom: 24px;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.${prefix}-label {
|
|
401
|
+
color: #393939;
|
|
402
|
+
font-size: 16px;
|
|
403
|
+
font-weight: 500;
|
|
404
|
+
margin-bottom: 6px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.${prefix}-button {
|
|
408
|
+
border-radius: 10px;
|
|
409
|
+
background: #393939;
|
|
410
|
+
display: flex;
|
|
411
|
+
justify-content: center;
|
|
412
|
+
align-items: center;
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
padding: 14px 0;
|
|
415
|
+
cursor: pointer;
|
|
416
|
+
height: 48px;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.${prefix}-button:hover {
|
|
420
|
+
background: #656565;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.${prefix}-button-text {
|
|
424
|
+
color: #fff;
|
|
425
|
+
text-align: center;
|
|
426
|
+
font-size: 16px;
|
|
427
|
+
font-weight: 700;
|
|
428
|
+
letter-spacing: 0.64px;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.${prefix}-auth-thrid-button {
|
|
432
|
+
border-radius: 5px;
|
|
433
|
+
background: #f1f1f1;
|
|
434
|
+
height: 50px;
|
|
435
|
+
flex: 1;
|
|
436
|
+
display: flex;
|
|
437
|
+
align-items: center;
|
|
438
|
+
justify-content: center;
|
|
439
|
+
cursor: pointer;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.${prefix}-auth-thrid-button:hover {
|
|
443
|
+
background: #dbdbdb;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.${prefix}-blue-note {
|
|
447
|
+
color: #4d86db;
|
|
448
|
+
cursor: pointer;
|
|
449
|
+
margin: 0 4px;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.${prefix}-blue-note:hover {
|
|
453
|
+
color: #4d86db !important;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.${prefix}-gray-hr {
|
|
457
|
+
flex: 1 1 auto !important;
|
|
458
|
+
height: 1px;
|
|
459
|
+
background-color: #ddd;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.${prefix}-font-16 {
|
|
463
|
+
font-size: 16px;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.${prefix}-font-14 {
|
|
467
|
+
font-size: 14px;
|
|
468
|
+
}
|
|
398
469
|
`);
|
|
399
470
|
}
|
|
400
471
|
static successCallback(gvc, widget, response, text) {
|
|
@@ -407,10 +478,13 @@ export class UMLogin {
|
|
|
407
478
|
widget.event('success', { title: text !== null && text !== void 0 ? text : Language.text('login_success') });
|
|
408
479
|
setTimeout(() => {
|
|
409
480
|
ApiUser.getUserData(GlobalUser.token, 'me').then(res => {
|
|
410
|
-
if (res.response.userData &&
|
|
481
|
+
if (res.response.userData &&
|
|
482
|
+
!res.response.userData.phone &&
|
|
483
|
+
window.login_config.phone_verify &&
|
|
484
|
+
gvc.glitter.getUrlParameter('page') !== 'account_edit') {
|
|
411
485
|
const dialog = new ShareDialog(gvc.glitter);
|
|
412
486
|
dialog.infoMessage({
|
|
413
|
-
text: Language.text('phone_verify_check')
|
|
487
|
+
text: Language.text('phone_verify_check'),
|
|
414
488
|
});
|
|
415
489
|
gvc.glitter.href = '/account_edit';
|
|
416
490
|
}
|
|
@@ -434,13 +508,13 @@ export class UMLogin {
|
|
|
434
508
|
}
|
|
435
509
|
static authThirdPartyHTML(gvc, widget, vm) {
|
|
436
510
|
const loginEvents = this.getAuthLoginEvents(gvc, widget);
|
|
437
|
-
return html
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
511
|
+
return html ` <div class="w-100 d-flex align-items-center gap-2" style="color:#8D8D8D;">
|
|
512
|
+
<div class="${vm.prefix}-gray-hr"></div>
|
|
513
|
+
${Language.text('or')}
|
|
514
|
+
<div class="${vm.prefix}-gray-hr"></div>
|
|
515
|
+
</div>
|
|
516
|
+
<div class="d-flex w-100 align-items-center justify-content-center gap-2">
|
|
517
|
+
${[
|
|
444
518
|
{
|
|
445
519
|
type: 'google',
|
|
446
520
|
icon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/252530754/Google__G__logo.svg.webp',
|
|
@@ -458,29 +532,29 @@ export class UMLogin {
|
|
|
458
532
|
icon: 'https://d3jnmi1tfjgtti.cloudfront.net/file/252530754/5968764.png',
|
|
459
533
|
},
|
|
460
534
|
]
|
|
461
|
-
.map(
|
|
535
|
+
.map(item => {
|
|
462
536
|
if (!vm.loginConfig[item.type]) {
|
|
463
537
|
return '';
|
|
464
538
|
}
|
|
465
539
|
if (gvc.glitter.deviceType === gvc.glitter.deviceTypeEnum.Android && item.type === 'apple') {
|
|
466
540
|
return ``;
|
|
467
541
|
}
|
|
468
|
-
const event = loginEvents.find(
|
|
542
|
+
const event = loginEvents.find(data => data.key === item.type);
|
|
469
543
|
if (!event) {
|
|
470
544
|
return '';
|
|
471
545
|
}
|
|
472
546
|
event.created();
|
|
473
|
-
return html
|
|
474
|
-
|
|
475
|
-
|
|
547
|
+
return html ` <div
|
|
548
|
+
class="${vm.prefix}-auth-thrid-button"
|
|
549
|
+
onclick="${gvc.event(() => {
|
|
476
550
|
event.call();
|
|
477
551
|
})}"
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
552
|
+
>
|
|
553
|
+
<img style="width: 28px" src="${item.icon}" />
|
|
554
|
+
</div>`;
|
|
481
555
|
})
|
|
482
556
|
.join('')}
|
|
483
|
-
|
|
557
|
+
</div>`;
|
|
484
558
|
}
|
|
485
559
|
static checkValue(name) {
|
|
486
560
|
const e = document.getElementById(name);
|
|
@@ -493,7 +567,7 @@ export class UMLogin {
|
|
|
493
567
|
vm.viewType = type;
|
|
494
568
|
}
|
|
495
569
|
static backToLogin(gvc, vm) {
|
|
496
|
-
return html
|
|
570
|
+
return html ` <section
|
|
497
571
|
class="m-auto d-flex align-items-center justify-content-center my-2"
|
|
498
572
|
style="cursor: pointer;"
|
|
499
573
|
onclick="${gvc.event(() => {
|
|
@@ -522,7 +596,9 @@ export class UMLogin {
|
|
|
522
596
|
}, 100);
|
|
523
597
|
}
|
|
524
598
|
})}"
|
|
525
|
-
|
|
599
|
+
>${n > 0
|
|
600
|
+
? Language.text('resend_code_timer').replace('xxx', n)
|
|
601
|
+
: Language.text('get_verification_code')}</span
|
|
526
602
|
>`;
|
|
527
603
|
},
|
|
528
604
|
divCreate: {
|
|
@@ -541,53 +617,12 @@ export class UMLogin {
|
|
|
541
617
|
static getAuthLoginEvents(gvc, widget) {
|
|
542
618
|
const glitter = gvc.glitter;
|
|
543
619
|
return [
|
|
544
|
-
{
|
|
545
|
-
|
|
546
|
-
created: () => {
|
|
547
|
-
if (gvc.glitter.getUrlParameter('state') === 'line_login') {
|
|
548
|
-
gvc.glitter.setUrlParameter('state', '');
|
|
549
|
-
ApiUser.login({
|
|
550
|
-
login_type: 'line',
|
|
551
|
-
line_token: gvc.glitter.getUrlParameter('code'),
|
|
552
|
-
redirect: (() => {
|
|
553
|
-
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
554
|
-
return 'app';
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
const url = new URL(location.origin + location.pathname);
|
|
558
|
-
if (gvc.glitter.getUrlParameter('appName')) {
|
|
559
|
-
url.searchParams.set('appName', window.appName);
|
|
560
|
-
}
|
|
561
|
-
return encodeURI(url.href);
|
|
562
|
-
}
|
|
563
|
-
})(),
|
|
564
|
-
}).then((r) => {
|
|
565
|
-
gvc.glitter.setUrlParameter('code', '');
|
|
566
|
-
if (r.result) {
|
|
567
|
-
this.successCallback(gvc, widget, r.response);
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
widget.event('error', { title: `Line: ${Language.text('login_failure')}` });
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
else {
|
|
575
|
-
ApiUser.getPublicConfig('login_line_setting', 'manager').then((dd) => {
|
|
576
|
-
widget.share.line = dd.response.value || {};
|
|
577
|
-
if (gvc.glitter.getUrlParameter('line_liff') === 'true') {
|
|
578
|
-
widget.event('loading', { visible: true });
|
|
579
|
-
setTimeout(() => {
|
|
580
|
-
localStorage.setItem('login_page', 'account');
|
|
581
|
-
}, 100);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
call: () => {
|
|
620
|
+
(() => {
|
|
621
|
+
function callLogin() {
|
|
587
622
|
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
588
623
|
gvc.glitter.runJsInterFace('line_login', {
|
|
589
624
|
id: widget.share.line.id,
|
|
590
|
-
},
|
|
625
|
+
}, response => {
|
|
591
626
|
if (response.result) {
|
|
592
627
|
gvc.glitter.setUrlParameter('state', 'line_login');
|
|
593
628
|
gvc.glitter.setUrlParameter('code', response.code);
|
|
@@ -599,8 +634,51 @@ export class UMLogin {
|
|
|
599
634
|
const redirect_url = location.origin + location.pathname;
|
|
600
635
|
gvc.glitter.href = `https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=${widget.share.line.id}&redirect_uri=${encodeURI(redirect_url)}&state=line_login&scope=profile%20openid%20email&nonce=09876xyz`;
|
|
601
636
|
}
|
|
602
|
-
}
|
|
603
|
-
|
|
637
|
+
}
|
|
638
|
+
return {
|
|
639
|
+
key: 'line',
|
|
640
|
+
created: () => {
|
|
641
|
+
if (gvc.glitter.getUrlParameter('state') === 'line_login') {
|
|
642
|
+
gvc.glitter.setUrlParameter('state', '');
|
|
643
|
+
ApiUser.login({
|
|
644
|
+
login_type: 'line',
|
|
645
|
+
line_token: gvc.glitter.getUrlParameter('code'),
|
|
646
|
+
redirect: (() => {
|
|
647
|
+
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
648
|
+
return 'app';
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
const url = new URL(location.origin + location.pathname);
|
|
652
|
+
if (gvc.glitter.getUrlParameter('appName')) {
|
|
653
|
+
url.searchParams.set('appName', window.appName);
|
|
654
|
+
}
|
|
655
|
+
return encodeURI(url.href);
|
|
656
|
+
}
|
|
657
|
+
})(),
|
|
658
|
+
}).then(r => {
|
|
659
|
+
gvc.glitter.setUrlParameter('code', '');
|
|
660
|
+
if (r.result) {
|
|
661
|
+
this.successCallback(gvc, widget, r.response);
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
widget.event('error', { title: `Line: ${Language.text('login_failure')}` });
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
else {
|
|
669
|
+
ApiUser.getPublicConfig('login_line_setting', 'manager').then((dd) => {
|
|
670
|
+
widget.share.line = dd.response.value || {};
|
|
671
|
+
if (gvc.glitter.getUrlParameter('line_liff') === 'true') {
|
|
672
|
+
callLogin();
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
call: () => {
|
|
678
|
+
callLogin();
|
|
679
|
+
},
|
|
680
|
+
};
|
|
681
|
+
})(),
|
|
604
682
|
{
|
|
605
683
|
key: 'google',
|
|
606
684
|
created: () => {
|
|
@@ -611,14 +689,14 @@ export class UMLogin {
|
|
|
611
689
|
google_token: gvc.glitter.getUrlParameter('code'),
|
|
612
690
|
redirect: (() => {
|
|
613
691
|
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
614
|
-
return
|
|
692
|
+
return glitter.deviceType === glitter.deviceTypeEnum.Android ? 'android' : 'app';
|
|
615
693
|
}
|
|
616
694
|
else {
|
|
617
695
|
const googleRedirect = localStorage.getItem('google_redirect');
|
|
618
696
|
return googleRedirect ? encodeURI(googleRedirect) : '';
|
|
619
697
|
}
|
|
620
698
|
})(),
|
|
621
|
-
}).then(
|
|
699
|
+
}).then(r => {
|
|
622
700
|
if (r.result) {
|
|
623
701
|
this.successCallback(gvc, widget, r.response);
|
|
624
702
|
}
|
|
@@ -628,7 +706,7 @@ export class UMLogin {
|
|
|
628
706
|
});
|
|
629
707
|
}
|
|
630
708
|
else {
|
|
631
|
-
ApiUser.getPublicConfig('login_google_setting', 'manager').then(
|
|
709
|
+
ApiUser.getPublicConfig('login_google_setting', 'manager').then(dd => {
|
|
632
710
|
widget.share.google = dd.response.value || {};
|
|
633
711
|
});
|
|
634
712
|
}
|
|
@@ -638,11 +716,13 @@ export class UMLogin {
|
|
|
638
716
|
localStorage.setItem('google_login', 'true');
|
|
639
717
|
localStorage.setItem('google_redirect', redirect_url);
|
|
640
718
|
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
641
|
-
ApiUser.getPublicConfig('login_google_setting', 'manager').then(
|
|
719
|
+
ApiUser.getPublicConfig('login_google_setting', 'manager').then(dd => {
|
|
642
720
|
widget.share.google = dd.response.value || {};
|
|
643
721
|
gvc.glitter.runJsInterFace('google_login', {
|
|
644
|
-
app_id:
|
|
645
|
-
|
|
722
|
+
app_id: glitter.deviceType === glitter.deviceTypeEnum.Android
|
|
723
|
+
? widget.share.google.android_app_id
|
|
724
|
+
: widget.share.google.app_id,
|
|
725
|
+
}, response => {
|
|
646
726
|
if (response.result) {
|
|
647
727
|
gvc.glitter.setUrlParameter('state', 'google_login');
|
|
648
728
|
gvc.glitter.setUrlParameter('code', response.code);
|
|
@@ -659,7 +739,7 @@ export class UMLogin {
|
|
|
659
739
|
{
|
|
660
740
|
key: 'fb',
|
|
661
741
|
created: () => {
|
|
662
|
-
ApiUser.getPublicConfig('login_fb_setting', 'manager').then(
|
|
742
|
+
ApiUser.getPublicConfig('login_fb_setting', 'manager').then(dd => {
|
|
663
743
|
widget.share.fb = dd.response.value || {};
|
|
664
744
|
const loadFacebookSDK = () => {
|
|
665
745
|
const intervalId = setInterval(() => {
|
|
@@ -670,7 +750,7 @@ export class UMLogin {
|
|
|
670
750
|
FB.init({
|
|
671
751
|
appId: widget.share.fb.id,
|
|
672
752
|
xfbml: true,
|
|
673
|
-
version: 'v22.0'
|
|
753
|
+
version: 'v22.0',
|
|
674
754
|
});
|
|
675
755
|
return;
|
|
676
756
|
}
|
|
@@ -693,13 +773,13 @@ export class UMLogin {
|
|
|
693
773
|
if (glitter.deviceType !== glitter.deviceTypeEnum.Web) {
|
|
694
774
|
gvc.glitter.runJsInterFace('facebook_login', {
|
|
695
775
|
app_id: widget.share.fb.id,
|
|
696
|
-
secret: widget.share.fb.secret
|
|
697
|
-
},
|
|
776
|
+
secret: widget.share.fb.secret,
|
|
777
|
+
}, response => {
|
|
698
778
|
if (response.result) {
|
|
699
779
|
ApiUser.login({
|
|
700
780
|
login_type: 'fb',
|
|
701
781
|
fb_token: response.accessToken,
|
|
702
|
-
}).then(
|
|
782
|
+
}).then(r => {
|
|
703
783
|
if (r.result) {
|
|
704
784
|
this.successCallback(gvc, widget, r.response);
|
|
705
785
|
}
|
|
@@ -716,7 +796,7 @@ export class UMLogin {
|
|
|
716
796
|
ApiUser.login({
|
|
717
797
|
login_type: 'fb',
|
|
718
798
|
fb_token: accessToken,
|
|
719
|
-
}).then(
|
|
799
|
+
}).then(r => {
|
|
720
800
|
if (r.result) {
|
|
721
801
|
this.successCallback(gvc, widget, r.response);
|
|
722
802
|
}
|
|
@@ -737,7 +817,7 @@ export class UMLogin {
|
|
|
737
817
|
ApiUser.login({
|
|
738
818
|
login_type: 'apple',
|
|
739
819
|
token: appleCode,
|
|
740
|
-
}).then(
|
|
820
|
+
}).then(r => {
|
|
741
821
|
if (r.result) {
|
|
742
822
|
this.successCallback(gvc, widget, r.response);
|
|
743
823
|
}
|
|
@@ -752,7 +832,7 @@ export class UMLogin {
|
|
|
752
832
|
src: 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js',
|
|
753
833
|
},
|
|
754
834
|
], () => {
|
|
755
|
-
ApiUser.getPublicConfig('login_apple_setting', 'manager').then(
|
|
835
|
+
ApiUser.getPublicConfig('login_apple_setting', 'manager').then(dd => {
|
|
756
836
|
widget.share.apple = dd.response.value || {};
|
|
757
837
|
});
|
|
758
838
|
}, () => { });
|
|
@@ -791,7 +871,8 @@ export class UMLogin {
|
|
|
791
871
|
if (item.hidden) {
|
|
792
872
|
continue;
|
|
793
873
|
}
|
|
794
|
-
if ((item.key === 'email' && vm.loginConfig.email_verify) ||
|
|
874
|
+
if ((item.key === 'email' && vm.loginConfig.email_verify) ||
|
|
875
|
+
(item.key === 'phone' && vm.loginConfig.phone_verify)) {
|
|
795
876
|
const vData = this.checkValue(`reg-${item.key}-verify`);
|
|
796
877
|
if (item.key === 'email') {
|
|
797
878
|
if (!vData) {
|
|
@@ -828,7 +909,7 @@ export class UMLogin {
|
|
|
828
909
|
account: userData.email || userData.phone,
|
|
829
910
|
pwd: password,
|
|
830
911
|
userData: userData,
|
|
831
|
-
}).then(
|
|
912
|
+
}).then(r => {
|
|
832
913
|
widget.event('loading', { visible: false });
|
|
833
914
|
if (r.result) {
|
|
834
915
|
this.successCallback(gvc, widget, r.response, Language.text('registration_success'));
|
|
@@ -866,7 +947,7 @@ export class UMLogin {
|
|
|
866
947
|
ApiUser.login({
|
|
867
948
|
account: account,
|
|
868
949
|
pwd: password,
|
|
869
|
-
}).then(
|
|
950
|
+
}).then(r => {
|
|
870
951
|
if (r.result) {
|
|
871
952
|
this.successCallback(gvc, widget, r.response);
|
|
872
953
|
}
|
|
@@ -889,7 +970,7 @@ export class UMLogin {
|
|
|
889
970
|
vm.resetEmail = email;
|
|
890
971
|
}
|
|
891
972
|
widget.event('loading', { visible: true });
|
|
892
|
-
ApiUser.forgetPwd(vm.resetEmail).then(
|
|
973
|
+
ApiUser.forgetPwd(vm.resetEmail).then(r => {
|
|
893
974
|
widget.event('loading', { visible: false });
|
|
894
975
|
if (r.result && r.response.result) {
|
|
895
976
|
widget.event('success', { title: Language.text('verification_code_sent') });
|
|
@@ -914,7 +995,7 @@ export class UMLogin {
|
|
|
914
995
|
widget.event('error', { title: Language.text('enter_valid_email') });
|
|
915
996
|
return;
|
|
916
997
|
}
|
|
917
|
-
ApiUser.emailVerify(email).then(
|
|
998
|
+
ApiUser.emailVerify(email).then(r => {
|
|
918
999
|
if (r.result && r.response.result) {
|
|
919
1000
|
widget.event('success', { title: Language.text('verification_code_sent') });
|
|
920
1001
|
}
|
|
@@ -938,7 +1019,7 @@ export class UMLogin {
|
|
|
938
1019
|
widget.event('error', { title: Language.text('phone_number_already_exists') });
|
|
939
1020
|
}
|
|
940
1021
|
else {
|
|
941
|
-
ApiUser.phoneVerify(phone).then(
|
|
1022
|
+
ApiUser.phoneVerify(phone).then(r => {
|
|
942
1023
|
if (r.result && r.response.result) {
|
|
943
1024
|
widget.event('success', { title: Language.text('verification_code_sent') });
|
|
944
1025
|
}
|
|
@@ -955,7 +1036,7 @@ export class UMLogin {
|
|
|
955
1036
|
widget.event('error', { title: Language.text('please_enter_verification_code') });
|
|
956
1037
|
return;
|
|
957
1038
|
}
|
|
958
|
-
ApiUser.forgetPwdCheckCode(vm.resetEmail, code).then(
|
|
1039
|
+
ApiUser.forgetPwdCheckCode(vm.resetEmail, code).then(r => {
|
|
959
1040
|
if (r.result && r.response.result) {
|
|
960
1041
|
vm.validationCode = code;
|
|
961
1042
|
vm.viewType = 'reset_password';
|
|
@@ -980,7 +1061,7 @@ export class UMLogin {
|
|
|
980
1061
|
widget.event('error', { title: Language.text('password_mismatch') });
|
|
981
1062
|
return;
|
|
982
1063
|
}
|
|
983
|
-
ApiUser.resetPwdV2(vm.resetEmail, vm.validationCode, newPassword).then(
|
|
1064
|
+
ApiUser.resetPwdV2(vm.resetEmail, vm.validationCode, newPassword).then(r => {
|
|
984
1065
|
vm.resetEmail = '';
|
|
985
1066
|
if (r.result && r.response.result) {
|
|
986
1067
|
widget.event('success', { title: Language.text('password_change_success') });
|