Commit 2ef1d974 authored by Liang Ding's avatar Liang Ding

🎨 Fix #12879

parent 2200ba1d
...@@ -54,7 +54,7 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -54,7 +54,7 @@ import java.util.concurrent.ConcurrentHashMap;
* </ul> * </ul>
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.0, Jul 13, 2019 * @version 1.0.1.1, Sep 12, 2019
* @since 2.9.5 * @since 2.9.5
*/ */
@RequestProcessor @RequestProcessor
...@@ -197,7 +197,7 @@ public class OAuthProcessor { ...@@ -197,7 +197,7 @@ public class OAuthProcessor {
try { try {
userMgmtService.addUser(addUserReq); userMgmtService.addUser(addUserReq);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Register via oauth failed", e); LOGGER.log(Level.ERROR, "Registers via oauth failed", e);
context.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); context.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return; return;
...@@ -207,13 +207,25 @@ public class OAuthProcessor { ...@@ -207,13 +207,25 @@ public class OAuthProcessor {
try { try {
userMgmtService.updateUser(user); userMgmtService.updateUser(user);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Update user GitHub id failed", e); LOGGER.log(Level.ERROR, "Updates user GitHub id failed", e);
context.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); context.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return; return;
} }
} }
} }
} else {
// 更改账号后无法登录 https://github.com/b3log/solo/issues/12879
// 使用 GitHub 登录名覆盖本地用户名,解决 GitHub 改名后引起的登录问题
user.put(User.USER_NAME, userName);
try {
userMgmtService.updateUser(user);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates user name failed", e);
context.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
} }
user = userQueryService.getUserByName(userName); user = userQueryService.getUserByName(userName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment