Showing
8 changed files
with
52 additions
and
20 deletions
@@ -29,6 +29,7 @@ import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | @@ -29,6 +29,7 @@ import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | ||
29 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 29 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
30 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; | 30 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; |
31 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 31 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
32 | +import org.thingsboard.server.common.data.yunteng.core.utils.AccountProperties; | ||
32 | import org.thingsboard.server.common.data.yunteng.utils.Demo; | 33 | import org.thingsboard.server.common.data.yunteng.utils.Demo; |
33 | import org.thingsboard.server.common.data.yunteng.utils.ExcelUtil; | 34 | import org.thingsboard.server.common.data.yunteng.utils.ExcelUtil; |
34 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | 35 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; |
@@ -65,6 +66,7 @@ public class YtUserController extends BaseController { | @@ -65,6 +66,7 @@ public class YtUserController extends BaseController { | ||
65 | private final UserService tbUserService; | 66 | private final UserService tbUserService; |
66 | private final ApplicationEventPublisher eventPublisher; | 67 | private final ApplicationEventPublisher eventPublisher; |
67 | private final SystemSecurityService systemSecurityService; | 68 | private final SystemSecurityService systemSecurityService; |
69 | + private final AccountProperties accountProperties; | ||
68 | 70 | ||
69 | @GetMapping("{userId}") | 71 | @GetMapping("{userId}") |
70 | public ResponseEntity<UserDTO> getUser(@PathVariable("userId") String userId) | 72 | public ResponseEntity<UserDTO> getUser(@PathVariable("userId") String userId) |
@@ -187,7 +189,7 @@ public class YtUserController extends BaseController { | @@ -187,7 +189,7 @@ public class YtUserController extends BaseController { | ||
187 | if (null == userDTO.getId()) { | 189 | if (null == userDTO.getId()) { |
188 | tbUser = createTBUser(tbUser, userDTO, tenantId, customerId, Authority.TENANT_ADMIN); | 190 | tbUser = createTBUser(tbUser, userDTO, tenantId, customerId, Authority.TENANT_ADMIN); |
189 | // 激活租户管理员 | 191 | // 激活租户管理员 |
190 | - activeTBUser(tbUser.getId(),FastIotConstants.DEFAULT_PWD); | 192 | + activeTBUser(tbUser.getId(),accountProperties.getDefaultPassword()); |
191 | } | 193 | } |
192 | } catch (Exception e) { | 194 | } catch (Exception e) { |
193 | throw handleException(e); | 195 | throw handleException(e); |
@@ -362,7 +364,7 @@ public class YtUserController extends BaseController { | @@ -362,7 +364,7 @@ public class YtUserController extends BaseController { | ||
362 | tbUser.setAuthority(authority); | 364 | tbUser.setAuthority(authority); |
363 | tbUser.setTenantId(tenantId); | 365 | tbUser.setTenantId(tenantId); |
364 | tbUser.setCustomerId(customerId); | 366 | tbUser.setCustomerId(customerId); |
365 | - tbUser.setEmail(userDTO.getUsername() + FastIotConstants.DEFAULT_EMAIL_SUFFIX_FOR_TB); | 367 | + tbUser.setEmail(userDTO.getUsername() +"@"+ accountProperties.getEmailSuffix()); |
366 | tbUser = tbUserService.saveUser(tbUser); | 368 | tbUser = tbUserService.saveUser(tbUser); |
367 | userDTO.setTbUser(tbUser.getId().getId().toString()); | 369 | userDTO.setTbUser(tbUser.getId().getId().toString()); |
368 | logEntityAction( | 370 | logEntityAction( |
@@ -35,6 +35,7 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -35,6 +35,7 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
35 | import org.thingsboard.server.common.data.id.UserId; | 35 | import org.thingsboard.server.common.data.id.UserId; |
36 | import org.thingsboard.server.common.data.security.Authority; | 36 | import org.thingsboard.server.common.data.security.Authority; |
37 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 37 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
38 | +import org.thingsboard.server.common.data.yunteng.core.utils.AccountProperties; | ||
38 | import org.thingsboard.server.common.data.yunteng.dto.UserDTO; | 39 | import org.thingsboard.server.common.data.yunteng.dto.UserDTO; |
39 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailsDTO; | 40 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailsDTO; |
40 | import org.thingsboard.server.dao.yunteng.service.YtUserService; | 41 | import org.thingsboard.server.dao.yunteng.service.YtUserService; |
@@ -59,6 +60,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | @@ -59,6 +60,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | ||
59 | private final CustomerService customerService; | 60 | private final CustomerService customerService; |
60 | private final TokenOutdatingService tokenOutdatingService; | 61 | private final TokenOutdatingService tokenOutdatingService; |
61 | private final YtUserService ytUserService; | 62 | private final YtUserService ytUserService; |
63 | + private final AccountProperties accountProperties; | ||
62 | 64 | ||
63 | @Override | 65 | @Override |
64 | public Authentication authenticate(Authentication authentication) throws AuthenticationException { | 66 | public Authentication authenticate(Authentication authentication) throws AuthenticationException { |
@@ -116,7 +118,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | @@ -116,7 +118,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | ||
116 | private SecurityUser authenticateByPlatFormUserId(UserId userId){ | 118 | private SecurityUser authenticateByPlatFormUserId(UserId userId){ |
117 | UserDTO userDTO =ytUserService.findUserInfoById(userId.getId().toString()); | 119 | UserDTO userDTO =ytUserService.findUserInfoById(userId.getId().toString()); |
118 | if(null != userDTO){ | 120 | if(null != userDTO){ |
119 | - String email = userDTO.getUsername() + FastIotConstants.DEFAULT_EMAIL_SUFFIX_FOR_TB; | 121 | + String email = userDTO.getUsername() + "@" +accountProperties.getEmailSuffix(); |
120 | UserPrincipal userPrincipal = new UserPrincipal(UserPrincipal.Type.USER_NAME, email); | 122 | UserPrincipal userPrincipal = new UserPrincipal(UserPrincipal.Type.USER_NAME, email); |
121 | User user = new User(); | 123 | User user = new User(); |
122 | user.setAuthority(Authority.PLATFORM_USER); | 124 | user.setAuthority(Authority.PLATFORM_USER); |
@@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.security.Authority; | @@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.security.Authority; | ||
33 | import org.thingsboard.server.common.data.security.UserCredentials; | 33 | import org.thingsboard.server.common.data.security.UserCredentials; |
34 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 34 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
35 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; | 35 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; |
36 | +import org.thingsboard.server.common.data.yunteng.core.utils.AccountProperties; | ||
36 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailRoleDTO; | 37 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailRoleDTO; |
37 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailsDTO; | 38 | import org.thingsboard.server.common.data.yunteng.dto.UserDetailsDTO; |
38 | import org.thingsboard.server.common.data.yunteng.dto.request.CodeTTL; | 39 | import org.thingsboard.server.common.data.yunteng.dto.request.CodeTTL; |
@@ -63,17 +64,20 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | @@ -63,17 +64,20 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | ||
63 | private final UserService userService; | 64 | private final UserService userService; |
64 | private final CustomerService customerService; | 65 | private final CustomerService customerService; |
65 | private final AuditLogService auditLogService; | 66 | private final AuditLogService auditLogService; |
67 | + private final AccountProperties accountProperties; | ||
66 | 68 | ||
67 | @Autowired | 69 | @Autowired |
68 | public RestAuthenticationProvider( | 70 | public RestAuthenticationProvider( |
69 | final UserService userService, | 71 | final UserService userService, |
70 | final CustomerService customerService, | 72 | final CustomerService customerService, |
71 | final SystemSecurityService systemSecurityService, | 73 | final SystemSecurityService systemSecurityService, |
72 | - final AuditLogService auditLogService) { | 74 | + final AuditLogService auditLogService, |
75 | + final AccountProperties accountProperties) { | ||
73 | this.userService = userService; | 76 | this.userService = userService; |
74 | this.customerService = customerService; | 77 | this.customerService = customerService; |
75 | this.systemSecurityService = systemSecurityService; | 78 | this.systemSecurityService = systemSecurityService; |
76 | this.auditLogService = auditLogService; | 79 | this.auditLogService = auditLogService; |
80 | + this.accountProperties = accountProperties; | ||
77 | } | 81 | } |
78 | 82 | ||
79 | @Override | 83 | @Override |
@@ -92,7 +96,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | @@ -92,7 +96,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | ||
92 | String ytUserName = username; | 96 | String ytUserName = username; |
93 | UserDetailsDTO ytDetailDTO = new UserDetailsDTO(); | 97 | UserDetailsDTO ytDetailDTO = new UserDetailsDTO(); |
94 | if (!FastIotConstants.EMAIL_PATTERN.matcher(username).matches()) { | 98 | if (!FastIotConstants.EMAIL_PATTERN.matcher(username).matches()) { |
95 | - username += FastIotConstants.DEFAULT_EMAIL_SUFFIX_FOR_TB; | 99 | + username += "@"+accountProperties.getEmailSuffix(); |
96 | ytDetailDTO = ytUserDetailsByUserName(ytUserName, password).get(); | 100 | ytDetailDTO = ytUserDetailsByUserName(ytUserName, password).get(); |
97 | // 如果是平台用户单独处理 | 101 | // 如果是平台用户单独处理 |
98 | if (isPlatFormUser(ytDetailDTO)) { | 102 | if (isPlatFormUser(ytDetailDTO)) { |
@@ -125,7 +129,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | @@ -125,7 +129,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | ||
125 | user.setTenantId(new TenantId(EntityId.NULL_UUID)); | 129 | user.setTenantId(new TenantId(EntityId.NULL_UUID)); |
126 | user.setId(new UserId(UUID.fromString(ytDetailDTO.getId()))); | 130 | user.setId(new UserId(UUID.fromString(ytDetailDTO.getId()))); |
127 | String email = ytDetailDTO.getUsername(); | 131 | String email = ytDetailDTO.getUsername(); |
128 | - email += FastIotConstants.DEFAULT_EMAIL_SUFFIX_FOR_TB; | 132 | + email += "@"+accountProperties.getEmailSuffix(); |
129 | user.setEmail(email); | 133 | user.setEmail(email); |
130 | UserCredentials userCredentials = new UserCredentials(); | 134 | UserCredentials userCredentials = new UserCredentials(); |
131 | SecurityUser securityUser = new SecurityUser(user, userCredentials.isEnabled(), userPrincipal); | 135 | SecurityUser securityUser = new SecurityUser(user, userCredentials.isEnabled(), userPrincipal); |
@@ -333,7 +337,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | @@ -333,7 +337,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | ||
333 | throw new BadCredentialsException("验证码不正确"); | 337 | throw new BadCredentialsException("验证码不正确"); |
334 | } | 338 | } |
335 | User user = new User(); | 339 | User user = new User(); |
336 | - String tbEmail = optionalUser.get().getUsername() + FastIotConstants.DEFAULT_EMAIL_SUFFIX_FOR_TB; | 340 | + String tbEmail = optionalUser.get().getUsername() + "@" + accountProperties.getEmailSuffix(); |
337 | UserDetailsDTO ytDetailDTO = optionalUser.get(); | 341 | UserDetailsDTO ytDetailDTO = optionalUser.get(); |
338 | //如果是平台管理员 | 342 | //如果是平台管理员 |
339 | if(isPlatFormUser(ytDetailDTO)){ | 343 | if(isPlatFormUser(ytDetailDTO)){ |
@@ -18,7 +18,7 @@ server: | @@ -18,7 +18,7 @@ server: | ||
18 | # Server bind address | 18 | # Server bind address |
19 | address: "${HTTP_BIND_ADDRESS:0.0.0.0}" | 19 | address: "${HTTP_BIND_ADDRESS:0.0.0.0}" |
20 | # Server bind port | 20 | # Server bind port |
21 | - port: "${HTTP_BIND_PORT:8080}" | 21 | + port: "${HTTP_BIND_PORT:36852}" |
22 | # Server SSL configuration | 22 | # Server SSL configuration |
23 | ssl: | 23 | ssl: |
24 | # Enable/disable SSL support | 24 | # Enable/disable SSL support |
@@ -529,9 +529,12 @@ spring: | @@ -529,9 +529,12 @@ spring: | ||
529 | database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}" | 529 | database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}" |
530 | datasource: | 530 | datasource: |
531 | driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}" | 531 | driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}" |
532 | - url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://101.133.234.90:5432/thingsboard-3.3.2}" | 532 | + #url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://47.99.141.212:20638/thingsboard-3.3.2}" |
533 | + #username: "${SPRING_DATASOURCE_USERNAME:postgres}" | ||
534 | + #password: "${SPRING_DATASOURCE_PASSWORD:Vrr861!@waja}" | ||
535 | + url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://101.133.234.90:28776/thingsboard-3.3.2}" | ||
533 | username: "${SPRING_DATASOURCE_USERNAME:postgres}" | 536 | username: "${SPRING_DATASOURCE_USERNAME:postgres}" |
534 | - password: "${SPRING_DATASOURCE_PASSWORD:Pgsql@yunteng}" | 537 | + password: "${SPRING_DATASOURCE_PASSWORD:Bua312!!iwcw}" |
535 | hikari: | 538 | hikari: |
536 | maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:16}" | 539 | maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:16}" |
537 | 540 | ||
@@ -1114,11 +1117,15 @@ file: | @@ -1114,11 +1117,15 @@ file: | ||
1114 | staticUrl: /oss/files/** #oss静态访问路径 只有type = local需要 | 1117 | staticUrl: /oss/files/** #oss静态访问路径 只有type = local需要 |
1115 | randomFileName: ${file.storage.randomFileName} | 1118 | randomFileName: ${file.storage.randomFileName} |
1116 | minio: | 1119 | minio: |
1117 | - minioUrl: http://101.133.234.90:9000 #minio储存地址 | 1120 | + minioUrl: http://47.99.141.212:9000 #minio储存地址 |
1118 | minioName: YunTeng #minio账户 | 1121 | minioName: YunTeng #minio账户 |
1119 | minioPass: YunTeng123456 #minio访问密码 | 1122 | minioPass: YunTeng123456 #minio访问密码 |
1120 | bucketName: yunteng #minio储存桶名称 | 1123 | bucketName: yunteng #minio储存桶名称 |
1121 | randomFileName: ${file.storage.randomFileName} | 1124 | randomFileName: ${file.storage.randomFileName} |
1125 | +account: | ||
1126 | + info: | ||
1127 | + emailSuffix: thingskit.com | ||
1128 | + defaultPassword: 123456 | ||
1122 | logging: | 1129 | logging: |
1123 | level: | 1130 | level: |
1124 | org.thingsboard.server.dao.yunteng.mapper: error | 1131 | org.thingsboard.server.dao.yunteng.mapper: error |
@@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.id.UserId; | @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.id.UserId; | ||
25 | import org.thingsboard.server.common.data.security.Authority; | 25 | import org.thingsboard.server.common.data.security.Authority; |
26 | import org.thingsboard.server.common.data.security.UserCredentials; | 26 | import org.thingsboard.server.common.data.security.UserCredentials; |
27 | import org.thingsboard.server.common.data.security.model.JwtToken; | 27 | import org.thingsboard.server.common.data.security.model.JwtToken; |
28 | +import org.thingsboard.server.common.data.yunteng.core.utils.AccountProperties; | ||
28 | import org.thingsboard.server.config.JwtSettings; | 29 | import org.thingsboard.server.config.JwtSettings; |
29 | import org.thingsboard.server.dao.customer.CustomerService; | 30 | import org.thingsboard.server.dao.customer.CustomerService; |
30 | import org.thingsboard.server.dao.user.UserService; | 31 | import org.thingsboard.server.dao.user.UserService; |
@@ -62,9 +63,15 @@ public class TokenOutdatingTest { | @@ -62,9 +63,15 @@ public class TokenOutdatingTest { | ||
62 | private JwtTokenFactory tokenFactory; | 63 | private JwtTokenFactory tokenFactory; |
63 | private JwtSettings jwtSettings; | 64 | private JwtSettings jwtSettings; |
64 | private YtUserService ytUserService; | 65 | private YtUserService ytUserService; |
66 | + private AccountProperties accountProperties; | ||
65 | 67 | ||
66 | private UserId userId; | 68 | private UserId userId; |
67 | 69 | ||
70 | + public TokenOutdatingTest(YtUserService ytUserService, AccountProperties accountProperties) { | ||
71 | + this.ytUserService = ytUserService; | ||
72 | + this.accountProperties = accountProperties; | ||
73 | + } | ||
74 | + | ||
68 | @BeforeEach | 75 | @BeforeEach |
69 | public void setUp() { | 76 | public void setUp() { |
70 | jwtSettings = new JwtSettings(); | 77 | jwtSettings = new JwtSettings(); |
@@ -94,7 +101,7 @@ public class TokenOutdatingTest { | @@ -94,7 +101,7 @@ public class TokenOutdatingTest { | ||
94 | 101 | ||
95 | accessTokenAuthenticationProvider = new JwtAuthenticationProvider(tokenFactory, tokenOutdatingService); | 102 | accessTokenAuthenticationProvider = new JwtAuthenticationProvider(tokenFactory, tokenOutdatingService); |
96 | refreshTokenAuthenticationProvider = new RefreshTokenAuthenticationProvider(tokenFactory, userService, mock(CustomerService.class), tokenOutdatingService, | 103 | refreshTokenAuthenticationProvider = new RefreshTokenAuthenticationProvider(tokenFactory, userService, mock(CustomerService.class), tokenOutdatingService, |
97 | - ytUserService); | 104 | + ytUserService,accountProperties); |
98 | } | 105 | } |
99 | 106 | ||
100 | @Test | 107 | @Test |
@@ -3,9 +3,6 @@ package org.thingsboard.server.common.data.yunteng.constant; | @@ -3,9 +3,6 @@ package org.thingsboard.server.common.data.yunteng.constant; | ||
3 | import java.util.regex.Pattern; | 3 | import java.util.regex.Pattern; |
4 | 4 | ||
5 | public interface FastIotConstants { | 5 | public interface FastIotConstants { |
6 | - | ||
7 | - /** 默认密码 */ | ||
8 | - String DEFAULT_PWD = "123456"; | ||
9 | Integer JAVA_SCRIPT = 0; | 6 | Integer JAVA_SCRIPT = 0; |
10 | Integer CONVERT_DATA = 1; | 7 | Integer CONVERT_DATA = 1; |
11 | Integer SCENE_REACT = 2; | 8 | Integer SCENE_REACT = 2; |
@@ -65,8 +62,6 @@ public interface FastIotConstants { | @@ -65,8 +62,6 @@ public interface FastIotConstants { | ||
65 | String MOBILE_LOGIN_SMS_CODE = "mobileLoginSmsCode"; | 62 | String MOBILE_LOGIN_SMS_CODE = "mobileLoginSmsCode"; |
66 | } | 63 | } |
67 | 64 | ||
68 | - String DEFAULT_EMAIL_SUFFIX_FOR_TB ="@yunteng.com"; | ||
69 | - | ||
70 | interface TBCacheConfig { | 65 | interface TBCacheConfig { |
71 | String TB_CACHE_CONFIG_KEY = "TB_CONNECT_CACHE"; | 66 | String TB_CACHE_CONFIG_KEY = "TB_CONNECT_CACHE"; |
72 | String EXISTING_TENANT = "EXISTING_TENANT"; | 67 | String EXISTING_TENANT = "EXISTING_TENANT"; |
1 | +package org.thingsboard.server.common.data.yunteng.core.utils; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
5 | +import org.springframework.stereotype.Component; | ||
6 | + | ||
7 | +@ConfigurationProperties(prefix = "account.info") | ||
8 | +@Component | ||
9 | +@Data | ||
10 | +public class AccountProperties { | ||
11 | + private String emailSuffix; | ||
12 | + private String defaultPassword; | ||
13 | +} |
@@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; | @@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; | ||
31 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; | 31 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; |
32 | import org.thingsboard.server.common.data.yunteng.core.exception.NoneTenantAssetException; | 32 | import org.thingsboard.server.common.data.yunteng.core.exception.NoneTenantAssetException; |
33 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 33 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
34 | +import org.thingsboard.server.common.data.yunteng.core.utils.AccountProperties; | ||
34 | import org.thingsboard.server.common.data.yunteng.dto.*; | 35 | import org.thingsboard.server.common.data.yunteng.dto.*; |
35 | import org.thingsboard.server.common.data.yunteng.dto.request.*; | 36 | import org.thingsboard.server.common.data.yunteng.dto.request.*; |
36 | import org.thingsboard.server.common.data.yunteng.enums.MessageTypeEnum; | 37 | import org.thingsboard.server.common.data.yunteng.enums.MessageTypeEnum; |
@@ -78,6 +79,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | @@ -78,6 +79,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | ||
78 | private final CacheUtils cacheUtils; | 79 | private final CacheUtils cacheUtils; |
79 | private final UserService tbUserService; | 80 | private final UserService tbUserService; |
80 | private final ApplicationEventPublisher eventPublisher; | 81 | private final ApplicationEventPublisher eventPublisher; |
82 | + private final AccountProperties accountProperties; | ||
81 | 83 | ||
82 | @Override | 84 | @Override |
83 | public List<UserDetailsDTO> findUserDetailsByUsername(String username,String tenantId) { | 85 | public List<UserDetailsDTO> findUserDetailsByUsername(String username,String tenantId) { |
@@ -104,7 +106,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | @@ -104,7 +106,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | ||
104 | if (StringUtils.isNotBlank(userDTO.getPassword())) { | 106 | if (StringUtils.isNotBlank(userDTO.getPassword())) { |
105 | user.setPassword(passwordEncoder.encode(userDTO.getPassword())); | 107 | user.setPassword(passwordEncoder.encode(userDTO.getPassword())); |
106 | } else { | 108 | } else { |
107 | - user.setPassword(passwordEncoder.encode(FastIotConstants.DEFAULT_PWD)); | 109 | + user.setPassword(passwordEncoder.encode(accountProperties.getDefaultPassword())); |
108 | } | 110 | } |
109 | userExist = | 111 | userExist = |
110 | baseMapper.selectCount( | 112 | baseMapper.selectCount( |
@@ -394,7 +396,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | @@ -394,7 +396,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | ||
394 | } | 396 | } |
395 | User user = new User(); | 397 | User user = new User(); |
396 | userDTO.copyToEntity(user, ID, PASSWORD, CREATE_TIME, UPDATE_TIME, ACTIVATE_TOKEN); | 398 | userDTO.copyToEntity(user, ID, PASSWORD, CREATE_TIME, UPDATE_TIME, ACTIVATE_TOKEN); |
397 | - user.setPassword(passwordEncoder.encode(FastIotConstants.DEFAULT_PWD)); | 399 | + user.setPassword(passwordEncoder.encode(accountProperties.getDefaultPassword())); |
398 | user.setLevel(FastIotConstants.LevelValue.IS_TENANT_ADMIN); | 400 | user.setLevel(FastIotConstants.LevelValue.IS_TENANT_ADMIN); |
399 | List<User> users = | 401 | List<User> users = |
400 | baseMapper.selectList( | 402 | baseMapper.selectList( |
@@ -510,7 +512,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | @@ -510,7 +512,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> | ||
510 | smsReqDTO.setPhoneNumbers(user.getPhoneNumber()); | 512 | smsReqDTO.setPhoneNumbers(user.getPhoneNumber()); |
511 | smsReqDTO.setId(templateDTOList.get(0).getId()); | 513 | smsReqDTO.setId(templateDTOList.get(0).getId()); |
512 | LinkedHashMap<String, String> params = new LinkedHashMap<>(); | 514 | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
513 | - params.put("code", FastIotConstants.DEFAULT_PWD); | 515 | + params.put("code", accountProperties.getDefaultPassword()); |
514 | smsReqDTO.setParams(params); | 516 | smsReqDTO.setParams(params); |
515 | ytSmsService.sendSms(smsReqDTO); | 517 | ytSmsService.sendSms(smsReqDTO); |
516 | } | 518 | } |