corebasic 1.0.19 → 1.0.20

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 +3 -2
  2. package/package.json +1 -1
package/libs/auth.js CHANGED
@@ -20,7 +20,7 @@ module.exports.start = (app, successCallback) => {
20
20
  let login = await attemptLogin(req, res)
21
21
  if (login.mode === 'verify' && login.success) {
22
22
  let tokens = Session.generateAccessToken(login.userId, req.body.clientId)
23
- let response = {tokens, ...login}
23
+ let response = {...login, tokens}
24
24
  if (successCallback)
25
25
  await successCallback(req, res, response)
26
26
  else
@@ -48,7 +48,8 @@ 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 meta = {createdAt: now, updatedAt: now, pos: req.body.pos ?? undefined}
51
+ let data = res.body.data ?? {}
52
+ let meta = {createdAt: now, updatedAt: now, pos: req.body.pos ?? undefined, ...data}
52
53
  await Elabase.update(collection, { _id: phone.trim() }, { $set: { otp, time, updatedAt: now }, $setOnInsert: { _id: phone.trim(), otp, time, userId, ...meta } }, { upsert: true })
53
54
  return {mode: 'login', success: true, userId, expiry}
54
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corebasic",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {