|
|
@@ -6,6 +6,7 @@ import cn.seecoder.seecoderportalserver.domain.User;
|
|
|
import cn.seecoder.seecoderportalserver.mapper.UserMapper;
|
|
|
import cn.seecoder.seecoderportalserver.repository.UserRepository;
|
|
|
import cn.seecoder.seecoderportalserver.web.rest.errors.CustomErrorException;
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabApi;
|
|
|
import com.nju.edu.gitlab.SeecoderGitlabException;
|
|
|
import com.nju.edu.gitlab.vo.GitlabUserVO;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -32,6 +33,7 @@ public class UserService {
|
|
|
private final UserMapper userMapper;
|
|
|
private final AliService aliService;
|
|
|
private final GitlabService gitlabService;
|
|
|
+ private final SeecoderGitlabApi gitlabApi;
|
|
|
|
|
|
public UserService(
|
|
|
UserRepository userRepository, PasswordEncoder passwordEncoder,
|
|
|
@@ -213,9 +215,16 @@ public class UserService {
|
|
|
try {
|
|
|
user.setPassword(userVO.getUsername());
|
|
|
GitlabUserVO gitlabUserVO = generateGitlabUser(user);
|
|
|
+ gitlabApi.changePassword(gitlabUserVO.getUserId(), userVO.getUsername());
|
|
|
} catch (CustomErrorException customErrorException) {
|
|
|
+ log.error("Yuantu register create gitlab user error");
|
|
|
+ log.error(customErrorException.getMessage());
|
|
|
userRepository.delete(savedUser);
|
|
|
throw customErrorException;
|
|
|
+ } catch (SeecoderGitlabException e) {
|
|
|
+ log.error("Yuantu register change password error");
|
|
|
+ log.error(e.getMessage());
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
log.debug("Created Information for Platform Yuantu User: {}", savedUser);
|
|
|
return userMapper.userToUserVO(savedUser);
|