-
Notifications
You must be signed in to change notification settings - Fork 3
[FIX/#459] 탈퇴 회원 재가입 시 계정 복구 처리 #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,8 +61,8 @@ public Member loadMember(String email) { | |
| commonAuth.setLastLoginAt(LocalDateTime.now()); | ||
| commonAuthRepository.save(commonAuth); | ||
|
|
||
| if (member.getDeletedAt() != null) { | ||
| member.setDeletedAt(null); | ||
| if (member.isWithdrawn()) { | ||
| member.restore(); | ||
|
Comment on lines
+64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
for f in \
src/main/java/com/assu/server/domain/auth/security/adapter/CommonAuthAdapter.java \
src/main/java/com/assu/server/domain/auth/service/LoginServiceImpl.java \
src/main/java/com/assu/server/domain/auth/service/BackofficeAuthServiceImpl.java \
src/main/java/com/assu/server/domain/member/entity/Member.java
do
if [ -f "$f" ]; then
echo "===== $f ====="
nl -ba "$f" | sed -n '1,220p'
fi
done
echo "===== related symbols ====="
rg -n --glob '*.java' 'loadMember\(|loginCommon|BackofficeAuthServiceImpl|isWithdrawn\(|restore\(|PARTNER|ADMIN|STUDENT' src/main/java/com/assu/server/domain/auth src/main/java/com/assu/server/domain/member | head -240Repository: ASSU-dev/ASSU_BE Length of output: 28732 Authorization Bypass Reachability: External 탈퇴한 🤖 Prompt for AI Agents |
||
| memberRepository.save(member); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| import com.assu.server.domain.auth.dto.signup.common.CommonInfoPayloadDTO; | ||
| import com.assu.server.domain.auth.dto.ssu.USaintAuthRequestDTO; | ||
| import com.assu.server.domain.auth.dto.ssu.USaintAuthResponseDTO; | ||
| import com.assu.server.domain.auth.entity.SSUAuth; | ||
| import com.assu.server.domain.auth.entity.enums.AuthRealm; | ||
| import com.assu.server.domain.auth.exception.CustomAuthException; | ||
| import com.assu.server.domain.auth.repository.SSUAuthRepository; | ||
|
|
@@ -78,11 +79,17 @@ public SignUpResponseDTO signupSsuStudent(StudentTokenSignUpRequestDTO req) { | |
|
|
||
| USaintAuthResponseDTO authResponse = ssuAuthService.uSaintAuth(authRequest); | ||
|
|
||
| if (ssuAuthRepository.existsByStudentNumber(authResponse.studentNumber())) { | ||
| throw new CustomAuthException(ErrorStatus.EXISTED_STUDENT); | ||
| // 2) 기존 계정 확인 — 탈퇴 유예기간 내라면 신규 생성 대신 복구한다 | ||
| Optional<SSUAuth> existingAuth = ssuAuthRepository.findByStudentNumber(authResponse.studentNumber()); | ||
| if (existingAuth.isPresent()) { | ||
| Member existingMember = existingAuth.get().getMember(); | ||
| if (!existingMember.isWithdrawn()) { | ||
| throw new CustomAuthException(ErrorStatus.EXISTED_STUDENT); | ||
| } | ||
| return restoreWithdrawnStudent(existingMember, req, authResponse); | ||
| } | ||
|
|
||
| // 2) member 생성 | ||
| // 3) member 생성 | ||
| Member member = memberRepository.save( | ||
| Member.builder() | ||
| .isLocationTermAgreed(req.locationAgree()) | ||
|
|
@@ -91,11 +98,11 @@ public SignUpResponseDTO signupSsuStudent(StudentTokenSignUpRequestDTO req) { | |
| .isActivated(ActivationStatus.ACTIVE) | ||
| .build()); | ||
|
|
||
| // 3) SSUAuth 생성 (학번만 저장) | ||
| // 4) SSUAuth 생성 (학번만 저장) | ||
| RealmAuthAdapter adapter = pickAdapter(AuthRealm.SSU); | ||
| adapter.registerCredentials(member, authResponse.studentNumber(), ""); // 더미 패스워드 | ||
|
|
||
| // 4) Student 프로필 생성 (크롤링된 정보 사용) | ||
| // 5) Student 프로필 생성 (크롤링된 정보 사용) | ||
| Major major = Major.fromDisplayName(authResponse.majorStr()); | ||
|
|
||
| Student student = studentRepository.save(Student.builder() | ||
|
|
@@ -110,17 +117,52 @@ public SignUpResponseDTO signupSsuStudent(StudentTokenSignUpRequestDTO req) { | |
| .build()); | ||
| member.setProfile(student); | ||
|
|
||
| // 5) 가입 시점 사용 가능 제휴 동기화 (자정 배치와 별개로 즉시 반영) | ||
| // 6) 가입 시점 사용 가능 제휴 동기화 (자정 배치와 별개로 즉시 반영) | ||
| studentService.syncUserPapersForStudent(student.getId()); | ||
|
|
||
| // 7) JWT 토큰 발급 | ||
| TokensDTO tokens = jwtUtil.issueTokens( | ||
| member.getId(), | ||
| authResponse.studentNumber(), | ||
| UserRole.STUDENT, | ||
| "SSU"); | ||
|
|
||
| return SignUpResponseDTO.from(member, tokens); | ||
| } | ||
|
|
||
| private SignUpResponseDTO restoreWithdrawnStudent( | ||
| Member member, | ||
| StudentTokenSignUpRequestDTO req, | ||
| USaintAuthResponseDTO authResponse | ||
| ) { | ||
| Student student = member.getStudentProfile(); | ||
| if (student == null) { | ||
| throw new CustomAuthException(ErrorStatus.NO_SUCH_MEMBER); | ||
| } | ||
|
|
||
| member.restore(); | ||
| member.updateTermAgreements(req.locationAgree(), req.marketingAgree()); | ||
| memberRepository.save(member); | ||
|
|
||
| Major major = Major.fromDisplayName(authResponse.majorStr()); | ||
| student.updateStudentInfo( | ||
| authResponse.name(), | ||
| major, | ||
| major.getDepartment(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 복구 시 복구 경로는 public void updateStudentInfo(String name, Major major, Department department,
EnrollmentStatus enrollmentStatus, String yearSemester) {
this.name = name;
this.major = major;
+ this.department = department;
this.enrollmentStatus = enrollmentStatus;
this.yearSemester = yearSemester;
}엔티티 갱신 메서드는 전달받은 최신 필드를 모두 엔티티 상태에 반영해야 합니다. 🤖 Prompt for AI Agents |
||
| parseEnrollmentStatus(authResponse.enrollmentStatus()), | ||
| authResponse.yearSemester() | ||
| ); | ||
| studentRepository.save(student); | ||
|
|
||
| // 탈퇴 기간 중 변동된 제휴를 반영한다 | ||
| studentService.syncUserPapersForStudent(student.getId()); | ||
|
|
||
| // 6) JWT 토큰 발급 | ||
| TokensDTO tokens = jwtUtil.issueTokens( | ||
| member.getId(), | ||
| authResponse.studentNumber(), | ||
| UserRole.STUDENT, | ||
| "SSU"); | ||
|
|
||
| // 6) SignUpResponseDTO 생성 | ||
| return SignUpResponseDTO.from(member, tokens); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
자동 복구 대상을 STUDENT로 제한해 문서화하세요.
이 문구는 모든 회원이 로그인 또는 재가입으로 자동 복구되는 것으로 보입니다. PR 요구사항은 STUDENT만 자동 복구 대상으로 지정하고, PARTNER와 ADMIN은 기존 중복 오류를 유지합니다.
SSU 학생 로그인 또는 학생 재가입으로 대상을 명시하세요.🤖 Prompt for AI Agents