@rpcbase/server 0.168.0 → 0.170.0
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/package.json +1 -1
- package/src/auth/sign_in.js +10 -3
package/package.json
CHANGED
package/src/auth/sign_in.js
CHANGED
|
@@ -29,14 +29,21 @@ const sign_in = async({email, password}, ctx) => {
|
|
|
29
29
|
|
|
30
30
|
if (is_match) {
|
|
31
31
|
log("compare_hash is match")
|
|
32
|
-
|
|
33
|
-
req.session.user_id =
|
|
32
|
+
const user_id = user._id.toString()
|
|
33
|
+
req.session.user_id = user_id
|
|
34
|
+
// add email to an array so that in the future
|
|
35
|
+
// we can support multiple accounts on the same session
|
|
36
|
+
if (!req.session.user_emails) {
|
|
37
|
+
req.session.user_emails = []
|
|
38
|
+
}
|
|
39
|
+
req.session.user_emails.push(email)
|
|
34
40
|
await req.session.save()
|
|
35
41
|
|
|
36
42
|
log("session saved, user is signed in")
|
|
37
43
|
|
|
38
44
|
return {
|
|
39
|
-
status: "ok"
|
|
45
|
+
status: "ok",
|
|
46
|
+
user_id,
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
} else {
|