Skip to content

Commit

Permalink
refactor: Update ChangePasswordService.myPasswordEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladik-gif committed Aug 30, 2024
1 parent 3d17e45 commit cd9d61a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chat.yourway.service;

import com.chat.yourway.config.security.MyPasswordEncoder;
import com.chat.yourway.dto.common.EmailMessageInfoDto;
import com.chat.yourway.dto.request.ChangePasswordDto;
import com.chat.yourway.dto.request.RestorePasswordDto;
Expand All @@ -10,7 +11,6 @@
import com.chat.yourway.repository.jpa.EmailTokenRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -19,7 +19,7 @@
@Slf4j
public class ChangePasswordService {

private final PasswordEncoder passwordEncoder;
private final MyPasswordEncoder myPasswordEncoder;
private final ContactService contactService;
private final EmailTokenRepository emailTokenRepository;
private final EmailMessageFactoryService emailMessageFactoryService;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void restorePassword(RestorePasswordDto restorePasswordDto) {
var emailToken = emailTokenRepository.findById(restorePasswordDto.getEmailToken())
.orElseThrow(EmailTokenNotFoundException::new);
var contact = emailToken.getContact();
var newEncodedPassword = passwordEncoder.encode(restorePasswordDto.getNewPassword());
var newEncodedPassword = myPasswordEncoder.encode(restorePasswordDto.getNewPassword());

contact.setPassword(newEncodedPassword);
emailTokenRepository.delete(emailToken);
Expand Down

0 comments on commit cd9d61a

Please sign in to comment.