谷歌登录-根据openid是否是邮箱区分新旧版本

This commit is contained in:
2025-08-18 18:49:50 +08:00
parent 643103531e
commit 1d77171763
2 changed files with 3 additions and 2 deletions

View File

@@ -141,7 +141,7 @@ public class EmailService extends BaseService {
} }
} }
private boolean isValidEmail(String email) { public boolean isValidEmail(String email) {
return !StringUtils.isEmpty(email) && email.matches(EMAIL_REGEX); return !StringUtils.isEmpty(email) && email.matches(EMAIL_REGEX);
} }
} }

View File

@@ -145,7 +145,8 @@ public class AccountManageService {
Account account = null; Account account = null;
String thirdAccountEmail = null; String thirdAccountEmail = null;
if (LoginTypeEnum.GOOGLE.getValue() == type) { // openid是邮箱则是新版本
if (LoginTypeEnum.GOOGLE.getValue() == type && emailService.isValidEmail(openid)) {
GoogleOpenidRef ref = googleOpenidRefService.getRefByEmail(openid, idToken); GoogleOpenidRef ref = googleOpenidRefService.getRefByEmail(openid, idToken);
if (null != ref) { if (null != ref) {
openid = ref.getOpenId(); openid = ref.getOpenId();