Add password change and user uniqueness validation
Introduced ChangePasswordDTO and implemented password change functionality in UserService and AuthenticationController. Added custom exceptions for existing email, username, and incorrect old password. Updated User entity and DTOs to include porOrgacode, and enforced uniqueness checks for userId and email. Enhanced ERRCode with new error codes and improved boolean field handling in User entity.dev-pending-01-01-2026
parent
a1f993bfd4
commit
5e85a32f61
@ -0,0 +1,11 @@
|
|||||||
|
package com.mfsys.aconnect.security.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChangePasswordDTO {
|
||||||
|
private String userId;
|
||||||
|
private String porOrgacode;
|
||||||
|
private String oldPassword;
|
||||||
|
private String newPassword;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.mfsys.aconnect.usermanagement.exceptions;
|
||||||
|
|
||||||
|
import com.mfsys.common.configuration.constant.ERRCode;
|
||||||
|
import com.mfsys.common.configuration.exception.ApplicationException;
|
||||||
|
|
||||||
|
public class EmailAlreadyExistException extends ApplicationException {
|
||||||
|
public EmailAlreadyExistException(String porOrgacode) {
|
||||||
|
super(porOrgacode, ERRCode.EMAIL_ALREADY_EXIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.mfsys.aconnect.usermanagement.exceptions;
|
||||||
|
|
||||||
|
import com.mfsys.common.configuration.constant.ERRCode;
|
||||||
|
import com.mfsys.common.configuration.exception.ResourceNotFoundException;
|
||||||
|
|
||||||
|
public class OldPasswordNotMatch extends ResourceNotFoundException {
|
||||||
|
|
||||||
|
public OldPasswordNotMatch(String porOrgacode) {
|
||||||
|
super(porOrgacode, ERRCode.PASSWORD_ALREADY_EXIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.mfsys.aconnect.usermanagement.exceptions;
|
||||||
|
|
||||||
|
import com.mfsys.common.configuration.constant.ERRCode;
|
||||||
|
import com.mfsys.common.configuration.exception.ApplicationException;
|
||||||
|
|
||||||
|
public class UsernameAlreadyExistException extends ApplicationException {
|
||||||
|
public UsernameAlreadyExistException(String porOrgacode) {
|
||||||
|
super(porOrgacode, ERRCode.USERNAME_ALREADY_EXIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue