use of com.github.nkonev.aaa.exception.BadRequestException in project videochat by nkonev.
the class UserAccountConverter method buildUserAccountEntityForInsert.
public static UserAccount buildUserAccountEntityForInsert(com.github.nkonev.aaa.dto.EditUserDTO userAccountDTO, PasswordEncoder passwordEncoder) {
final boolean expired = false;
final boolean locked = false;
final boolean enabled = false;
final UserRole newUserRole = getDefaultUserRole();
validateLoginAndEmail(userAccountDTO);
userAccountDTO = validateAndTrimLogin(userAccountDTO);
String password = userAccountDTO.password();
try {
validateUserPassword(password);
} catch (IllegalArgumentException e) {
throw new BadRequestException(e.getMessage());
}
return new UserAccount(null, CreationType.REGISTRATION, userAccountDTO.login(), passwordEncoder.encode(password), userAccountDTO.avatar(), userAccountDTO.avatarBig(), expired, locked, enabled, newUserRole, userAccountDTO.email(), null, null);
}
Aggregations