Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.
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 @@ -27,7 +27,6 @@
import org.bounswe.jobboardbackend.notification.service.NotificationService;
import org.bounswe.jobboardbackend.workplace.repository.EmployerWorkplaceRepository;
import org.bounswe.jobboardbackend.workplace.service.WorkplaceService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
Expand All @@ -45,8 +44,8 @@
@Service
@RequiredArgsConstructor
public class AuthService {
@Value("${app.env}")
private String appEnv;
// @Value("${app.env}")
// private String appEnv;
private final JwtUtils jwtUtils;
private final AuthenticationManager authenticationManager;
private final UserRepository userRepository;
Expand Down Expand Up @@ -164,7 +163,8 @@ public MessageResponse registerAndSendVerification(@Valid RegisterRequest regist
};

newUser.setRole(role);
newUser.setEmailVerified(!appEnv.equals("prod"));
newUser.setEmailVerified(true);
//newUser.setEmailVerified(!appEnv.equals("prod"));
userRepository.save(newUser);

Profile profile = Profile.builder()
Expand All @@ -178,9 +178,9 @@ public MessageResponse registerAndSendVerification(@Valid RegisterRequest regist

profileRepository.save(profile);

if (appEnv.equals("prod")) {
sendEmailForRegister(newUser);
}
// if (appEnv.equals("prod")) {
// sendEmailForRegister(newUser);
// }

activityService.logActivity(newUser, ActivityType.REGISTER, newUser.getId(), "User");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.bounswe.jobboardbackend.auth.security.JwtUtils;
import org.bounswe.jobboardbackend.exception.ErrorCode;
import org.bounswe.jobboardbackend.exception.HandleException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.time.Duration;
Expand All @@ -21,9 +20,9 @@
@Service
@RequiredArgsConstructor
public class OtpService {
@Value("${app.env}")
private String appEnv;
private final EmailService emailService;
// @Value("${app.env}")
// private String appEnv;
// private final EmailService emailService;
private final UserRepository userRepository;
private final OtpRepository otpRepository;
private final JwtUtils jwtUtils;
Expand All @@ -35,7 +34,8 @@ public void sendOtp(String username, String temporaryToken) {
User user = userRepository.findByUsername(username)
.orElseThrow(() -> new HandleException(ErrorCode.USER_NOT_FOUND, "User not found"));

String otpCode = appEnv.equals("prod") ? generateOtp() : "000000";
//String otpCode = appEnv.equals("prod") ? generateOtp() : "000000";
String otpCode = "000000";
LocalDateTime expiresAt = LocalDateTime.now().plus(OTP_EXPIRATION_TIME);

otpRepository.deleteByUsername(username);
Expand All @@ -46,9 +46,9 @@ public void sendOtp(String username, String temporaryToken) {
otp.setExpiresAt(expiresAt);
otp.setTemporaryToken(temporaryToken);
otpRepository.save(otp);
if (appEnv.equals("prod")) {
emailService.sendOtpEmail(user.getEmail(), otpCode);
}
// if (appEnv.equals("prod")) {
// emailService.sendOtpEmail(user.getEmail(), otpCode);
// }
}


Expand Down