corebasic 1.0.20 → 1.0.21

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 (2) hide show
  1. package/libs/auth.js +2 -2
  2. package/package.json +1 -1
package/libs/auth.js CHANGED
@@ -48,7 +48,7 @@ async function attemptLogin(req, res) {
48
48
  if (await sendOtp(phone, otp)) {
49
49
  let userId = req.body.userId ?? Utils.uid()
50
50
  let now = Utils.now().toISOString()
51
- let data = res.body.data ?? {}
51
+ let data = req.body.data ?? {}
52
52
  let meta = {createdAt: now, updatedAt: now, pos: req.body.pos ?? undefined, ...data}
53
53
  await Elabase.update(collection, { _id: phone.trim() }, { $set: { otp, time, updatedAt: now }, $setOnInsert: { _id: phone.trim(), otp, time, userId, ...meta } }, { upsert: true })
54
54
  return {mode: 'login', success: true, userId, expiry}
@@ -72,7 +72,7 @@ async function sendOtp(phone, otp) {
72
72
 
73
73
  // API
74
74
  // ----
75
- // Login => HttpRequest.post('/login').send({app: '', clientId: '', phone: '', userId: 'Optional'}) // Response => { mode: 'login', success, userId }
75
+ // Login => HttpRequest.post('/login').send({app: '', clientId: '', phone: '', userId: 'Optional', data: {//optional} }) // Response => { mode: 'login', success, userId, expiry }
76
76
  // Verify => HttpRequest.post('/login').send({app: '', clientId: '', phone: '', otp: ''}) // Response => { mode: 'verify', success, userId }
77
77
 
78
78
  // Usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corebasic",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {