Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
ab1d2106
Unverified
Commit
ab1d2106
authored
Mar 27, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
解决特殊情况下用户绑定 GH 账号问题
parent
6c81abe2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
+11
-1
src/main/java/org/b3log/solo/service/UserMgmtService.java
src/main/java/org/b3log/solo/service/UserMgmtService.java
+8
-2
No files found.
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
View file @
ab1d2106
...
...
@@ -54,7 +54,7 @@ import java.util.concurrent.ConcurrentHashMap;
* </ul>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
7, Mar 4
, 2019
* @version 1.0.0.
8, Mar 27
, 2019
* @since 2.9.5
*/
@RequestProcessor
...
...
@@ -202,6 +202,16 @@ public class OAuthProcessor {
LOGGER
.
log
(
Level
.
ERROR
,
"Register via oauth failed"
,
e
);
context
.
sendError
(
HttpServletResponse
.
SC_INTERNAL_SERVER_ERROR
);
return
;
}
}
else
{
user
.
put
(
UserExt
.
USER_GITHUB_ID
,
openId
);
try
{
userMgmtService
.
updateUser
(
user
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
"Update user GitHub id failed"
,
e
);
context
.
sendError
(
HttpServletResponse
.
SC_INTERNAL_SERVER_ERROR
);
return
;
}
}
...
...
src/main/java/org/b3log/solo/service/UserMgmtService.java
View file @
ab1d2106
...
...
@@ -48,7 +48,7 @@ import javax.servlet.http.HttpServletResponse;
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/DASHU">DASHU</a>
* @author <a href="https://github.com/nanolikeyou">nanolikeyou</a>
* @version 1.1.0.1
7, Mar 20
, 2019
* @version 1.1.0.1
8, Mar 27
, 2019
* @since 0.4.0
*/
@Service
...
...
@@ -156,7 +156,8 @@ public class UserMgmtService {
* "userName": "",
* "userRole": "",
* "userURL": "",
* "userB3Key": ""
* "userB3Key": "",
* "userGitHubId": "" // optional
* @throws ServiceException service exception
*/
public
void
updateUser
(
final
JSONObject
requestJSONObject
)
throws
ServiceException
{
...
...
@@ -192,6 +193,11 @@ public class UserMgmtService {
final
String
userB3Key
=
requestJSONObject
.
optString
(
UserExt
.
USER_B3_KEY
);
oldUser
.
put
(
UserExt
.
USER_B3_KEY
,
userB3Key
);
final
String
userGitHubId
=
requestJSONObject
.
optString
(
UserExt
.
USER_GITHUB_ID
);
if
(
StringUtils
.
isNotBlank
(
userGitHubId
))
{
oldUser
.
put
(
UserExt
.
USER_GITHUB_ID
,
userGitHubId
);
}
userRepository
.
update
(
oldUserId
,
oldUser
);
transaction
.
commit
();
}
catch
(
final
RepositoryException
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment