From 8e5e0b9cefa02baf1d31500711cf4127a83415f2 Mon Sep 17 00:00:00 2001 From: yeungchihang <842328916@qq.com> Date: Mon, 5 Dec 2022 15:45:56 +0800 Subject: [PATCH] =?UTF-8?q?oauth-=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C-dev=E7=8E=AF=E5=A2=83=E6=94=BE=E5=BC=80=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accompany/oauth2/service/MyUserDetailsServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accompany-oauth2/accompany-oauth2-service/src/main/java/com/accompany/oauth2/service/MyUserDetailsServiceImpl.java b/accompany-oauth2/accompany-oauth2-service/src/main/java/com/accompany/oauth2/service/MyUserDetailsServiceImpl.java index f902868a9..ac7e11db8 100644 --- a/accompany-oauth2/accompany-oauth2-service/src/main/java/com/accompany/oauth2/service/MyUserDetailsServiceImpl.java +++ b/accompany-oauth2/accompany-oauth2-service/src/main/java/com/accompany/oauth2/service/MyUserDetailsServiceImpl.java @@ -33,6 +33,7 @@ import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.jms.core.JmsTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.security.core.userdetails.UserDetails; @@ -51,6 +52,8 @@ import java.util.Optional; @Slf4j public class MyUserDetailsServiceImpl implements MyUserDetailsService { + @Value("spring.profiles.active:dev") + private String activeProfile; @Autowired private JedisService jedisService; @Autowired @@ -109,7 +112,7 @@ public class MyUserDetailsServiceImpl implements MyUserDetailsService { throws Exception { Account account = null; log.info("phone:{}, phoneAreaCode:{}, smsCode:{}, deviceInfo:{}, ipAddress:{}",phone,phoneAreaCode,smsCode,deviceInfo,ipAddress); - if (CommonUtil.checkPhoneFormat(phoneAreaCode,phone)) { + if (CommonUtil.checkPhoneFormat(phoneAreaCode,phone) || "dev".equals(activeProfile)) { account = accountManageService.getOrGenAccountByPhone(phone,phoneAreaCode,smsCode,deviceInfo,ipAddress); } else if (CommonUtil.checkNumberOnly(phone)) { account = accountService.getAccountByErBanNo(Long.valueOf(phone));