Skip to content
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

merge: (#109) 비밀번호 초기화 변경 사항 #113

Merged
merged 1 commit into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ class SecurityConfig(
.antMatchers(HttpMethod.POST, "/users").permitAll()
.antMatchers(HttpMethod.POST, "/users/tokens").permitAll()
.antMatchers(HttpMethod.GET, "/users/information").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.PUT, "/users/password/initialization").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.PUT, "/users/profile-image").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.PUT, "/users/nickname").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.PUT, "/users/email").hasRole(ROLE_COMMON.role)

// commons
.antMatchers(HttpMethod.GET, "/commons/employee-number").permitAll()
.antMatchers(HttpMethod.PUT, "/commons/token/reissue").permitAll()
.antMatchers(HttpMethod.PUT, "/commons/password").permitAll()

// emails
.antMatchers(HttpMethod.GET, "/emails").permitAll()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package team.comit.simtong.common

import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.*
import team.comit.simtong.domain.auth.usecase.ReissueTokenUseCase
import team.comit.simtong.domain.auth.dto.TokenResponse
import team.comit.simtong.common.dto.request.WebFindEmployeeNumberRequest
import team.comit.simtong.common.dto.response.WebFindEmployeeNumberResponse
import team.comit.simtong.domain.user.usecase.FindEmployeeNumberUseCase
import team.comit.simtong.domain.auth.dto.TokenResponse
import team.comit.simtong.domain.auth.usecase.ReissueTokenUseCase
import team.comit.simtong.domain.user.dto.FindEmployeeNumberRequest
import team.comit.simtong.domain.user.dto.ResetPasswordRequest
import team.comit.simtong.domain.user.usecase.FindEmployeeNumberUseCase
import team.comit.simtong.domain.user.usecase.ResetPasswordUseCase
import team.comit.simtong.user.dto.request.WebResetPasswordRequest
import javax.validation.Valid

/**
Expand All @@ -21,7 +25,8 @@ import javax.validation.Valid
@RequestMapping("/commons")
class WebCommonAdapter(
private val reissueTokenUseCase: ReissueTokenUseCase,
private val findEmployeeNumberUseCase: FindEmployeeNumberUseCase
private val findEmployeeNumberUseCase: FindEmployeeNumberUseCase,
private val resetPasswordUseCase: ResetPasswordUseCase
) {

@GetMapping("/employee-number")
Expand All @@ -40,4 +45,16 @@ class WebCommonAdapter(
return reissueTokenUseCase.execute(request)
}

@PutMapping("/password")
@ResponseStatus(HttpStatus.NO_CONTENT)
fun resetPassword(@Valid @RequestBody request: WebResetPasswordRequest) {
resetPasswordUseCase.execute(
ResetPasswordRequest(
email = request.email,
employeeNumber = request.employeeNumber,
newPassword = request.newPassword
)
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ import team.comit.simtong.domain.auth.dto.TokenResponse
import team.comit.simtong.domain.user.dto.ChangeEmailRequest
import team.comit.simtong.domain.user.dto.ChangeNicknameRequest
import team.comit.simtong.domain.user.dto.ChangeProfileImageRequest
import team.comit.simtong.domain.user.dto.ResetPasswordRequest
import team.comit.simtong.domain.user.dto.SignInRequest
import team.comit.simtong.domain.user.dto.SignUpRequest
import team.comit.simtong.domain.user.dto.UserInfoResponse
import team.comit.simtong.domain.user.usecase.ChangeEmailUseCase
import team.comit.simtong.domain.user.usecase.ChangeNicknameUseCase
import team.comit.simtong.domain.user.usecase.ChangeProfileImageUseCase
import team.comit.simtong.domain.user.usecase.ResetPasswordUseCase
import team.comit.simtong.domain.user.usecase.SignInUseCase
import team.comit.simtong.domain.user.usecase.SignUpUseCase
import team.comit.simtong.domain.user.usecase.UserInfoUseCase
import team.comit.simtong.user.dto.request.WebChangeEmailRequest
import team.comit.simtong.user.dto.request.WebChangeNicknameRequest
import team.comit.simtong.user.dto.request.WebChangeProfileImageRequest
import team.comit.simtong.user.dto.request.WebResetPasswordRequest
import team.comit.simtong.user.dto.request.WebSignInRequest
import team.comit.simtong.user.dto.request.WebSignUpRequest
import javax.validation.Valid
Expand All @@ -48,8 +45,7 @@ class WebUserAdapter(
private val getInfoUseCase: UserInfoUseCase,
private val changeEmailUseCase: ChangeEmailUseCase,
private val changeNicknameUseCase: ChangeNicknameUseCase,
private val changeProfileImageUseCase: ChangeProfileImageUseCase,
private val resetPasswordUseCase: ResetPasswordUseCase
private val changeProfileImageUseCase: ChangeProfileImageUseCase
) {

@ResponseStatus(HttpStatus.CREATED)
Expand Down Expand Up @@ -89,18 +85,6 @@ class WebUserAdapter(
nickname = request.nickname
))
}

@PutMapping("/password/initialization")
@ResponseStatus(HttpStatus.NO_CONTENT)
fun resetPassword(@Valid @RequestBody request: WebResetPasswordRequest) {
resetPasswordUseCase.execute(
ResetPasswordRequest(
email = request.email,
employeeNumber = request.employeeNumber,
newPassword = request.newPassword
)
)
}

@PutMapping("/email")
@ResponseStatus(HttpStatus.NO_CONTENT)
Expand Down