|
|
@@ -5,10 +5,10 @@ import cn.reghao.jutil.jdk.result.ResultStatus;
|
|
|
import cn.reghao.jutil.jdk.security.RandomString;
|
|
|
import cn.reghao.jutil.jdk.string.StringRegexp;
|
|
|
import cn.reghao.tnb.account.api.constant.VerifyChannel;
|
|
|
+import cn.reghao.tnb.account.api.dto.AccountRegistry;
|
|
|
import cn.reghao.tnb.account.api.dto.AdminCreateAccount;
|
|
|
import cn.reghao.tnb.account.app.model.dto.UserRegisterDto;
|
|
|
import cn.reghao.tnb.account.app.db.repository.AccountRepository;
|
|
|
-import cn.reghao.tnb.account.app.model.po.UserAccountRole;
|
|
|
import cn.reghao.tnb.account.app.model.po.UserRegistry;
|
|
|
import cn.reghao.tnb.account.app.service.CodeService;
|
|
|
import cn.reghao.tnb.account.app.model.po.UserAccount;
|
|
|
@@ -19,7 +19,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
|
/**
|
|
|
* @author reghao
|
|
|
@@ -48,8 +47,18 @@ public class AccountRegistryServiceImpl implements AccountRegistryService {
|
|
|
this.avatarUrl = String.format("//%s/dist/images/face.jpg", domain);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public UserRegistry getUserRegistry() {
|
|
|
+ return accountRepository.getUserRegistry();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public synchronized Result createAccount(UserRegisterDto userRegisterDto) {
|
|
|
+ UserRegistry userRegistry = accountRepository.getUserRegistry();
|
|
|
+ if (!userRegistry.getEnabled()) {
|
|
|
+ return Result.fail("系统当前未开放注册");
|
|
|
+ }
|
|
|
+
|
|
|
String captchaCode = userRegisterDto.getCaptchaCode();
|
|
|
String savedCaptchaCode = codeService.getCaptcha();
|
|
|
if (savedCaptchaCode == null) {
|
|
|
@@ -92,7 +101,7 @@ public class AccountRegistryServiceImpl implements AccountRegistryService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void createAccount(AdminCreateAccount adminCreateAccount) {
|
|
|
+ public void createAdminAccount(AdminCreateAccount adminCreateAccount) {
|
|
|
String principal = adminCreateAccount.getUsername();
|
|
|
String email = null;
|
|
|
String mobile = null;
|