@jetthai/cuora 1.0.168-1 → 1.0.168-2
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/machine/auth.js +18 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.168-2](https://github.com/jetthai/cuora-module/compare/v1.0.168-1...v1.0.168-2) (2022-09-26)
|
|
6
|
+
|
|
5
7
|
### [1.0.168-1](https://github.com/jetthai/cuora-module/compare/v1.0.168...v1.0.168-1) (2022-09-23)
|
|
6
8
|
|
|
7
9
|
### [1.0.168](https://github.com/jetthai/cuora-module/compare/v1.0.167...v1.0.168) (2022-09-12)
|
package/package.json
CHANGED
package/src/machine/auth.js
CHANGED
|
@@ -11,6 +11,7 @@ export default function (request) {
|
|
|
11
11
|
const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
|
|
12
12
|
const tokenKey = `cuora_${clientId}`
|
|
13
13
|
const userKey = `cuora_tempuser`
|
|
14
|
+
const phoneCountryCode = 'phone_countrycode'
|
|
14
15
|
const accountPhoneKey = 'account_phone'
|
|
15
16
|
const accountEmailKey = 'account_email'
|
|
16
17
|
const cookies = new Cookies()
|
|
@@ -31,6 +32,7 @@ export default function (request) {
|
|
|
31
32
|
username: null,
|
|
32
33
|
password: null,
|
|
33
34
|
},
|
|
35
|
+
countryAbbr: null,
|
|
34
36
|
userInfo: {},
|
|
35
37
|
redirectURL: null,
|
|
36
38
|
reCaptchaToken: null,
|
|
@@ -209,7 +211,7 @@ export default function (request) {
|
|
|
209
211
|
}
|
|
210
212
|
}),
|
|
211
213
|
setLoginPhone: assign((context, event) => {
|
|
212
|
-
const { countryCode, phone, password } = event.data
|
|
214
|
+
const { countryCode, countryAbbr, phone, password } = event.data
|
|
213
215
|
return {
|
|
214
216
|
loginData: {
|
|
215
217
|
provider: 'phone',
|
|
@@ -217,6 +219,7 @@ export default function (request) {
|
|
|
217
219
|
phone,
|
|
218
220
|
password,
|
|
219
221
|
},
|
|
222
|
+
countryAbbr,
|
|
220
223
|
}
|
|
221
224
|
}),
|
|
222
225
|
setLoginEmail: assign((context, event) => {
|
|
@@ -261,12 +264,17 @@ export default function (request) {
|
|
|
261
264
|
setAccount: assign((context, event) => {
|
|
262
265
|
if (context.loginData.phone) {
|
|
263
266
|
cookies.remove(accountEmailKey)
|
|
264
|
-
cookies.set(accountPhoneKey,
|
|
267
|
+
cookies.set(accountPhoneKey, `${context.loginData.phone}`, {
|
|
268
|
+
path: '/',
|
|
269
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
270
|
+
})
|
|
271
|
+
cookies.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
|
|
265
272
|
path: '/',
|
|
266
273
|
maxAge: 60 * 60 * 24 * 7,
|
|
267
274
|
})
|
|
268
275
|
} else if (context.loginData.email) {
|
|
269
276
|
cookies.remove(accountPhoneKey)
|
|
277
|
+
cookies.remove(phoneCountryCode)
|
|
270
278
|
cookies.set(accountEmailKey, context.loginData.email, {
|
|
271
279
|
path: '/',
|
|
272
280
|
maxAge: 60 * 60 * 24 * 7,
|
|
@@ -306,14 +314,14 @@ export default function (request) {
|
|
|
306
314
|
const redirectURL = urljoin(
|
|
307
315
|
request.config.fullURL,
|
|
308
316
|
'login?' +
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
+
new URLSearchParams({
|
|
318
|
+
provider,
|
|
319
|
+
redirectURI: `${window.location.protocol}//${window.location.host}`,
|
|
320
|
+
channel: cookies.get('channel') || channel || defaultChannel || 'official',
|
|
321
|
+
subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
322
|
+
// dt,
|
|
323
|
+
platform: 'pwa',
|
|
324
|
+
}).toString()
|
|
317
325
|
)
|
|
318
326
|
window.location.href = redirectURL
|
|
319
327
|
},
|