@waline/vercel 1.3.1 → 1.3.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/package.json +1 -1
- package/src/controller/oauth.js +9 -3
- package/src/controller/user.js +8 -4
- package/src/logic/base.js +1 -0
package/package.json
CHANGED
package/src/controller/oauth.js
CHANGED
|
@@ -24,7 +24,10 @@ module.exports = class extends think.Controller {
|
|
|
24
24
|
type,
|
|
25
25
|
})}`;
|
|
26
26
|
return this.redirect(
|
|
27
|
-
`${oauthUrl}/${type}?${qs.stringify({
|
|
27
|
+
`${oauthUrl}/${type}?${qs.stringify({
|
|
28
|
+
redirect: redirectUrl,
|
|
29
|
+
state: this.ctx.state.token,
|
|
30
|
+
})}`
|
|
28
31
|
);
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -38,7 +41,10 @@ module.exports = class extends think.Controller {
|
|
|
38
41
|
redirect,
|
|
39
42
|
type,
|
|
40
43
|
})}`;
|
|
41
|
-
params.state = qs.stringify({
|
|
44
|
+
params.state = qs.stringify({
|
|
45
|
+
redirect: redirectUrl,
|
|
46
|
+
state: this.ctx.state.token || '',
|
|
47
|
+
});
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
const user = await request({
|
|
@@ -83,7 +89,7 @@ module.exports = class extends think.Controller {
|
|
|
83
89
|
objectId: current.objectId,
|
|
84
90
|
});
|
|
85
91
|
|
|
86
|
-
return this.
|
|
92
|
+
return this.redirect('/ui/profile');
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
const userByEmail = await this.modelInstance.select({ email: user.email });
|
package/src/controller/user.js
CHANGED
|
@@ -78,7 +78,7 @@ module.exports = class extends BaseRest {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
async putAction() {
|
|
81
|
-
const { display_name, url, password
|
|
81
|
+
const { display_name, url, password } = this.post();
|
|
82
82
|
const { objectId } = this.ctx.state.userInfo;
|
|
83
83
|
|
|
84
84
|
const updateData = {};
|
|
@@ -95,9 +95,13 @@ module.exports = class extends BaseRest {
|
|
|
95
95
|
updateData.password = new PasswordHash().hashPassword(password);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
const socials = ['github', 'twitter', 'facebook', 'google', 'weibo', 'qq'];
|
|
99
|
+
socials.forEach((social) => {
|
|
100
|
+
const nextSocial = this.post(social);
|
|
101
|
+
if (think.isString(nextSocial)) {
|
|
102
|
+
updateData[social] = nextSocial;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
101
105
|
|
|
102
106
|
if (think.isEmpty(updateData)) {
|
|
103
107
|
return this.success();
|