corebasic 1.0.25 → 1.0.26
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/libs/auth.js +2 -2
- package/package.json +1 -1
package/libs/auth.js
CHANGED
|
@@ -40,8 +40,8 @@ async function attemptLogin(req, res) {
|
|
|
40
40
|
let collection = (req.body.app ? req.body.app + '.' : '') + "auth.login"
|
|
41
41
|
if (req.body.otp) { // verify login
|
|
42
42
|
let res = await Elabase.query(collection, { _id: phone, otp: req.body.otp, time: { $gt: time - expiry } })
|
|
43
|
-
if (res.length)
|
|
44
|
-
return {mode: 'verify', success: true, userId: res[0].userId, position: res[0].position, phone: res[0]._id}
|
|
43
|
+
if (res.length)
|
|
44
|
+
return {...res[0], mode: 'verify', success: true, userId: res[0].userId, position: res[0].position, phone: res[0]._id}
|
|
45
45
|
throw {mode: 'verify', success: false, msg: "Invalid OTP"}
|
|
46
46
|
} else { // generate login
|
|
47
47
|
let otp = phone === '0123456789' ? '1234' : otpGenerator.generate(4, { upperCaseAlphabets: false, specialChars: false, digital: true, lowerCaseAlphabets: false });
|